Skip to content

Commit

Permalink
Make sure short tests are actually passing
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryNguyen5 committed Apr 30, 2024
1 parent 2e99468 commit 6ca25b4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ jobs:
slack-message: "golangci-lint failed: ${{ job.html_url }}\n${{ format('https://github.com/smartcontractkit/chainlink/actions/runs/{0}', github.run_id) }}"

core:
env:
# We explicitly have this env var not be "CL_DATABASE_URL" to avoid having it be used by core related tests
# when they should not be using it, while still allowing us to DRY up the setup
DB_URL: postgresql://postgres:postgres@localhost:5432/chainlink_test?sslmode=disable
strategy:
fail-fast: false
matrix:
Expand All @@ -92,8 +96,6 @@ jobs:
if: github.actor != 'dependabot[bot]'
needs: [filter]
runs-on: ubuntu-latest-64cores-256GB
env:
CL_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/chainlink_test?sslmode=disable
steps:
- name: Checkout the repo
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
Expand Down Expand Up @@ -136,6 +138,8 @@ jobs:
- name: Setup DB
if: ${{ needs.filter.outputs.changes == 'true' }}
run: ./chainlink.test local db preparetest
env:
CL_DATABASE_URL: ${{ env.DB_URL }}
- name: Install LOOP Plugins
if: ${{ needs.filter.outputs.changes == 'true' }}
run: |
Expand Down Expand Up @@ -165,6 +169,7 @@ jobs:
env:
OUTPUT_FILE: ./output.txt
USE_TEE: false
CL_DATABASE_URL: ${{ env.DB_URL }}
run: ./tools/bin/${{ matrix.type.cmd }} ./...
- name: Print Filtered Test Results
if: ${{ failure() && matrix.type.cmd == 'go_core_tests' && needs.filter.outputs.changes == 'true' }}
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ go test ./...

- The `parallel` flag can be used to limit CPU usage, for running tests in the background (`-parallel=4`) - the default is `GOMAXPROCS`
- The `p` flag can be used to limit the number of _packages_ tested concurrently, if they are interferring with one another (`-p=1`)
- The `-short` flag skips tests which depend on the database, for quickly spot checking simpler tests in around one minute
- The `-short` flag skips tests which depend on the database, for quickly spot checking simpler tests in around one minute.

```bash

#### Race Detector

Expand Down
2 changes: 2 additions & 0 deletions core/chains/evm/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest"
"github.com/smartcontractkit/chainlink/v2/core/services/chainlink"
"github.com/smartcontractkit/chainlink/v2/core/store/models"
)

func TestChainScopedConfig(t *testing.T) {
Expand Down Expand Up @@ -380,6 +381,7 @@ func TestChainScopedConfig_HeadTracker(t *testing.T) {
func Test_chainScopedConfig_Validate(t *testing.T) {
configWithChains := func(t *testing.T, id int64, chains ...*toml.Chain) config.AppConfig {
return configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) {
s.Database.URL = models.MustSecretURL("postgresql://doesnotexist:justtopassvalidationtests@localhost:5432/chainlink_na_test")
chainID := ubig.NewI(id)
c.EVM[0] = &toml.EVMConfig{ChainID: chainID, Enabled: ptr(true), Chain: toml.Defaults(chainID, chains...),
Nodes: toml.EVMNodes{{
Expand Down
2 changes: 2 additions & 0 deletions core/services/chainlink/config_database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
func TestDatabaseConfig(t *testing.T) {
opts := GeneralConfigOpts{
ConfigStrings: []string{fullTOML},
SecretsStrings: []string{`[Database]
URL = "postgresql://doesnotexist:justtopassvalidationtests@localhost:5432/chainlink_na_test"`},
}
cfg, err := opts.New()
require.NoError(t, err)
Expand Down

0 comments on commit 6ca25b4

Please sign in to comment.