-
Notifications
You must be signed in to change notification settings - Fork 950
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- Thank you for submitting a pull request! Please make sure you have reviewed our contributors guide before submitting your first PR. Please ensure you've addressed or included references to any related issues. Tips: - Use keywords like "closes" or "fixes" followed by an issue number to automatically close related issues when the PR is merged (e.g., "closes #123" or "fixes #123"). - Describe the changes made in the PR. - Ensure the PR has one of the required tags (kind:fix, kind:misc, kind:break!, kind:refactor, kind:feat, kind:deps, kind:docs, kind:ci, kind:chore, kind:testing) --> Building off @vgonkivs's [work to skip tests](#2802), this attempts to get a baseline "green" ci for us. There are still a couple of tests that VERY intermittently flake in CI, but this way they will stand out WHEN they happen and we can track down vs entire thing being red always. This does quite a few things - introduces build tags on swamp tests in each named file to allow us to run parts of the swamp/integration tests independently (ie: `go test ./... -tags=blob` - adds an `integration` tag to allow running all still - splits the integration tests into it's own workflow file (`integration-tests.yml`) which is now triggered from `go-ci.yml` - splits each swamp/integration tests to run as its own job so we can see which are failing/flakey more explicitly - utilizes go's -short test flag to Skip a few swamp/integration tests that are consistently failing. Current we are skipping `TestFullReconstructFromFulls`, `TestFullReconstructFromLights`, `TestSyncStartStopLightWithBridge` which is less than we were originally skipping in #2802 - plugs in our verbose/debug stuff to integration tests in addition to unit which we had before Unit tests - splits some of the unit tests that were "race flakey" into `*_no_race_test.go` and adds `!race` tag to some others to get to pass consistently when running unit tests with -race flag - macos-latest unit tests still fail on race test ONLY in GitHub actions CI 🤷♂️ Next Steps - create issues for each short run / skipped - create issues for any tests that fail race that are NOT the race issue on upstream cosmos-sdk - create issue for macos-latest in GitHub race fail - create issue for macos-latest intermittent fail I think we let this run for a while, then once we see it be consistently green for a bit and isolate any more flakes that pop up, we can toggle on more branch requirements, then in fixing the above issues, we can be green. [Being green is not easy](https://www.youtube.com/watch?v=51BQfPeSK8k).
- Loading branch information
Showing
21 changed files
with
390 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
name: Integration Tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
go-version: | ||
description: 'Go version' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
api_tests: | ||
name: Integration Tests API | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: set up go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ inputs.go-version }} | ||
|
||
- name: run API tests | ||
run: make test-integration TAGS=api | ||
|
||
blob_tests: | ||
name: Integration Tests Blob | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: set up go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ inputs.go-version }} | ||
|
||
- name: run blob tests | ||
run: make test-integration TAGS=blob | ||
|
||
fraud_tests: | ||
name: Integration Tests Fraud | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: set up go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ inputs.go-version }} | ||
|
||
- name: run fraud tests | ||
run: make test-integration TAGS=fraud | ||
|
||
nd_tests: | ||
name: Integration Tests ND | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: set up go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ inputs.go-version }} | ||
|
||
- name: run nd tests | ||
run: make test-integration TAGS=nd | ||
|
||
p2p_tests: | ||
name: Integration Tests p2p | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: set up go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ inputs.go-version }} | ||
|
||
- name: run p2p tests | ||
run: make test-integration TAGS=p2p | ||
|
||
reconstruction_tests: | ||
name: Integration Tests Reconstruction | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: set up go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ inputs.go-version }} | ||
|
||
- name: run reconstruction tests | ||
run: make test-integration SHORT=true TAGS=reconstruction | ||
|
||
sync_tests: | ||
name: Integration Tests Sync | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: set up go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ inputs.go-version }} | ||
|
||
- name: run sync tests | ||
run: make test-integration SHORT=true TAGS=sync |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
//go:build !race | ||
|
||
package core | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
"github.com/tendermint/tendermint/types" | ||
) | ||
|
||
// TestBlockFetcherHeaderValues tests that both the Commit and ValidatorSet | ||
// endpoints are working as intended. | ||
func TestBlockFetcherHeaderValues(t *testing.T) { | ||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) | ||
t.Cleanup(cancel) | ||
|
||
client := StartTestNode(t).Client | ||
fetcher := NewBlockFetcher(client) | ||
|
||
// generate some blocks | ||
newBlockChan, err := fetcher.SubscribeNewBlockEvent(ctx) | ||
require.NoError(t, err) | ||
// read once from channel to generate next block | ||
var h int64 | ||
select { | ||
case evt := <-newBlockChan: | ||
h = evt.Header.Height | ||
case <-ctx.Done(): | ||
require.NoError(t, ctx.Err()) | ||
} | ||
// get Commit from current height | ||
commit, err := fetcher.Commit(ctx, &h) | ||
require.NoError(t, err) | ||
// get ValidatorSet from current height | ||
valSet, err := fetcher.ValidatorSet(ctx, &h) | ||
require.NoError(t, err) | ||
// get next block | ||
var nextBlock types.EventDataSignedBlock | ||
select { | ||
case nextBlock = <-newBlockChan: | ||
case <-ctx.Done(): | ||
require.NoError(t, ctx.Err()) | ||
} | ||
// compare LastCommit from next block to Commit from first block height | ||
assert.Equal(t, nextBlock.Header.LastCommitHash, commit.Hash()) | ||
assert.Equal(t, nextBlock.Header.Height, commit.Height+1) | ||
// compare ValidatorSet hash to the ValidatorsHash from first block height | ||
hexBytes := valSet.Hash() | ||
assert.Equal(t, nextBlock.ValidatorSet.Hash(), hexBytes) | ||
require.NoError(t, fetcher.UnsubscribeNewBlockEvent(ctx)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.