mirror of
https://github.com/go-micro/go-micro.git
synced 2026-04-30 19:15:24 +02:00
dbb66ec938
* Initial plan * Replace KeepAliveOnce with KeepAlive to reduce etcd auth requests Co-authored-by: asim <17530+asim@users.noreply.github.com> * Add tests to verify cache penetration protection via singleflight Co-authored-by: asim <17530+asim@users.noreply.github.com> * Add etcd integration tests to CI workflow Co-authored-by: asim <17530+asim@users.noreply.github.com> * Fix race conditions and improve code quality based on review feedback Co-authored-by: asim <17530+asim@users.noreply.github.com> * Add workflow permissions to fix security scan finding Co-authored-by: asim <17530+asim@users.noreply.github.com> * Add comprehensive documentation for performance improvements Co-authored-by: asim <17530+asim@users.noreply.github.com> * Fix memory store limit/offset bug causing events test failure Co-authored-by: asim <17530+asim@users.noreply.github.com> * Fix memory store to filter before limiting in prefix/suffix reads The previous fix had a logic error where limit/offset were applied before prefix/suffix filtering. This could cause incorrect results when the first N items in the unfiltered list don't match the search criteria. Now filters first to get all matching keys, then applies limit/offset to the filtered results. This ensures ReadLimit(1) always returns 1 matching record if available, regardless of map iteration order. Co-authored-by: asim <17530+asim@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: asim <17530+asim@users.noreply.github.com>
75 lines
1.8 KiB
YAML
75 lines
1.8 KiB
YAML
name: Run Tests
|
|
on:
|
|
push:
|
|
branches:
|
|
- "**"
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- reopened
|
|
branches:
|
|
- "**"
|
|
jobs:
|
|
unittests:
|
|
name: Unit Tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.24
|
|
check-latest: true
|
|
cache: true
|
|
- name: Get dependencies
|
|
run: |
|
|
go install github.com/kyoh86/richgo@latest
|
|
go get -v -t -d ./...
|
|
- name: Run tests
|
|
id: tests
|
|
run: richgo test -v -race -cover ./...
|
|
env:
|
|
IN_TRAVIS_CI: yes
|
|
RICHGO_FORCE_COLOR: 1
|
|
|
|
etcd-integration:
|
|
name: Etcd Integration Tests
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
services:
|
|
etcd:
|
|
image: quay.io/coreos/etcd:v3.5.2
|
|
env:
|
|
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
|
|
ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379
|
|
ports:
|
|
- 2379:2379
|
|
options: >-
|
|
--health-cmd "etcdctl endpoint health"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.24
|
|
check-latest: true
|
|
cache: true
|
|
- name: Get dependencies
|
|
run: |
|
|
go install github.com/kyoh86/richgo@latest
|
|
go get -v -t -d ./...
|
|
- name: Wait for etcd
|
|
run: |
|
|
timeout 30 bash -c 'until curl -s http://localhost:2379/health; do sleep 1; done'
|
|
- name: Run etcd integration tests
|
|
run: richgo test -v -race ./registry/etcd/...
|
|
env:
|
|
ETCD_ADDRESS: localhost:2379
|
|
IN_TRAVIS_CI: yes
|
|
RICHGO_FORCE_COLOR: 1
|
|
|