Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT REVIEW #2710

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 4 additions & 47 deletions .github/workflows/test-and-upload-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
client-type: [go, http, cli]
database-type: [badger-file, badger-memory]
mutation-type: [gql, collection-named, collection-save]
client-type: [go]
database-type: [badger-file]
mutation-type: [gql]
lens-type: [wasm-time]
detect-changes: [false]
database-encryption: [false]
Expand Down Expand Up @@ -117,48 +117,5 @@ jobs:

- name: Run integration tests
if: ${{ !matrix.detect-changes }}
run: make test:coverage
run: go test ./events --run TestSimpleEachSubscribersRecievesEachItemGivenBufferedEventChan2

- name: Run change detector tests
if: ${{ matrix.detect-changes }}
run: make test:changes

- name: Upload coverage artifact
if: ${{ !matrix.detect-changes }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}_${{ matrix.client-type }}_${{ matrix.database-type }}_${{ matrix.mutation-type }}
path: coverage.txt
if-no-files-found: error
retention-days: 7

upload-coverage:
name: Upload test code coverage job

needs: run-tests

# Important to know:
# - We didn't use `if: always()` here, so this job doesn't run if we manually canceled.
# - `if: success()` is always implied unless `always()` or `failure()` is specified.
if: success() || failure()

runs-on: ubuntu-latest

steps:
- name: Checkout code into the directory
uses: actions/checkout@v3

- name: Download coverage reports
uses: actions/download-artifact@v3
with:
path: coverage_reports

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: defradb-codecov
flags: all-tests
os: 'linux'
fail_ci_if_error: true
verbose: true
24 changes: 24 additions & 0 deletions events/simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,27 @@ func TestSimpleSubscribersDontRecieveItemsAfterUnsubscribing(t *testing.T) {
// closing the channel will result in reads yielding the default value
assert.Equal(t, 0, <-ch)
}
func TestSimpleEachSubscribersRecievesEachItemGivenBufferedEventChan2(t *testing.T) {
c := NewSimpleChannel[Update](1000000, 5)
for i := 0; i < 100; i++ {
sub, err := c.Subscribe()
if err != nil {
panic(err)
}
defer c.Unsubscribe(sub)
go handleChannelMessages(sub)
}
for i := 0; i < 1000; i++ {
c.Publish(
Update{
DocID: "test",
},
)
}
}
func handleChannelMessages(sub Subscription[Update]) {
for msg := range sub {
_ = msg
time.Sleep(1 * time.Millisecond)
}
}
Loading