Skip to content

Commit

Permalink
skip tests when -short (#12869)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 authored Apr 18, 2024
1 parent 8337fc8 commit aa57182
Show file tree
Hide file tree
Showing 20 changed files with 82 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ jobs:
- name: Setup Go
if: ${{ needs.filter.outputs.changes == 'true' }}
uses: ./.github/actions/setup-go
- name: Run short tests
run: go test -short ./...
- name: Setup Solana
if: ${{ needs.filter.outputs.changes == 'true' }}
uses: ./.github/actions/setup-solana
Expand Down
3 changes: 3 additions & 0 deletions core/chains/evm/headtracker/head_listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
)

func Test_HeadListener_HappyPath(t *testing.T) {
t.Parallel()
// Logic:
// - spawn a listener instance
// - mock SubscribeNewHead/Err/Unsubscribe to track these calls
Expand Down Expand Up @@ -91,6 +92,7 @@ func Test_HeadListener_HappyPath(t *testing.T) {
}

func Test_HeadListener_NotReceivingHeads(t *testing.T) {
t.Parallel()
// Logic:
// - same as Test_HeadListener_HappyPath, but
// - send one head, make sure ReceivingHeads() is true
Expand Down Expand Up @@ -149,6 +151,7 @@ func Test_HeadListener_NotReceivingHeads(t *testing.T) {
}

func Test_HeadListener_SubscriptionErr(t *testing.T) {
t.Parallel()
tests := []struct {
name string
err error
Expand Down
4 changes: 2 additions & 2 deletions core/chains/evm/log/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,6 @@ func TestBroadcaster_BackfillUnconsumedAfterCrash(t *testing.T) {
log2 := blocks.LogOnBlockNum(log2Block, contract2.Address())
logs := []types.Log{log1, log2}

contract1.On("ParseLog", log1).Return(flux_aggregator_wrapper.FluxAggregatorNewRound{}, nil)
contract2.On("ParseLog", log2).Return(flux_aggregator_wrapper.FluxAggregatorAnswerUpdated{}, nil)
t.Run("pool two logs from subscription, then shut down", func(t *testing.T) {
helper := newBroadcasterHelper(t, 0, 1, logs, func(c *chainlink.Config, s *chainlink.Secrets) {
c.EVM[0].FinalityDepth = ptr[uint32](confs)
Expand Down Expand Up @@ -295,6 +293,8 @@ func TestBroadcaster_BackfillUnconsumedAfterCrash(t *testing.T) {
c.EVM[0].FinalityDepth = ptr[uint32](confs)
})
orm := log.NewORM(helper.db, cltest.FixtureChainID)
contract1.On("ParseLog", log1).Return(flux_aggregator_wrapper.FluxAggregatorNewRound{}, nil)
contract2.On("ParseLog", log2).Return(flux_aggregator_wrapper.FluxAggregatorAnswerUpdated{}, nil)

listener := helper.newLogListenerWithJob("one")
listener.SkipMarkingConsumed(true)
Expand Down
31 changes: 19 additions & 12 deletions core/gethwrappers/go_generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package gethwrappers

import (
"crypto/sha256"
"flag"
"fmt"
"os"
"os/exec"
Expand All @@ -15,6 +16,7 @@ import (
"github.com/fatih/color"

cutils "github.com/smartcontractkit/chainlink-common/pkg/utils"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils"
"github.com/smartcontractkit/chainlink/v2/core/utils"

"github.com/stretchr/testify/assert"
Expand All @@ -27,6 +29,7 @@ const compileCommand = "../../contracts/scripts/native_solc_compile_all"
// contract artifacts in contracts/solc with the abi and bytecode stored in the
// contract wrapper
func TestCheckContractHashesFromLastGoGenerate(t *testing.T) {
testutils.SkipShort(t, "requires compiled artifacts")
versions, err := ReadVersionsDB()
require.NoError(t, err)
require.NotEmpty(t, versions.GethVersion, `version DB should have a "GETH_VERSION:" line`)
Expand Down Expand Up @@ -63,19 +66,13 @@ func isVRFV2Contract(fullpath string) bool {
return strings.Contains(fullpath, "VRFCoordinatorV2")
}

// rootDir is the local chainlink root working directory
var rootDir string

func init() { // compute rootDir
var err error
thisDir, err := os.Getwd()
if err != nil {
panic(err)
}
rootDir, err = filepath.Abs(filepath.Join(thisDir, "../.."))
// getRootDir returns the local chainlink root working directory
func getRootDir() (string, error) { // compute rootDir
wd, err := os.Getwd()
if err != nil {
panic(err)
return "", fmt.Errorf("failed to get working directory: %w", err)
}
return filepath.Abs(filepath.Join(wd, "../.."))
}

// compareCurrentCompilerArtifactAgainstRecordsAndSoliditySources checks that
Expand All @@ -95,16 +92,26 @@ func compareCurrentCompilerArtifactAgainstRecordsAndSoliditySources(
t *testing.T, versionInfo ContractVersion,
) {
hash := VersionHash(versionInfo.AbiPath, versionInfo.BinaryPath)
rootDir, err := getRootDir()
require.NoError(t, err)
recompileCommand := fmt.Sprintf("(cd %s/contracts; make wrappers-all)", rootDir)
assert.Equal(t, versionInfo.Hash, hash,
utils.BoxOutput(`compiled %s and/or %s has changed; please rerun
%s,
and commit the changes`, versionInfo.AbiPath, versionInfo.BinaryPath, recompileCommand))
}

func TestMain(m *testing.M) {
flag.Parse()
if !testing.Short() {
ensureArtifacts()
}
os.Exit(m.Run())
}

// Ensure that solidity compiler artifacts are present before running this test,
// by compiling them if necessary.
func init() {
func ensureArtifacts() {
db, err := versionsDBLineReader()
if err != nil {
panic(err)
Expand Down
1 change: 1 addition & 0 deletions core/services/fluxmonitorv2/contract_submitter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
)

func TestFluxAggregatorContractSubmitter_Submit(t *testing.T) {
t.Parallel()
var (
fluxAggregator = mocks.NewFluxAggregator(t)
orm = fmmocks.NewORM(t)
Expand Down
8 changes: 8 additions & 0 deletions core/services/fluxmonitorv2/flux_monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ func setupFullDBWithKey(t *testing.T) (*sqlx.DB, common.Address) {
}

func TestFluxMonitor_PollIfEligible(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
eligible bool
Expand Down Expand Up @@ -499,6 +500,7 @@ func TestFluxMonitor_PollIfEligible(t *testing.T) {
// If the roundState method is unable to communicate with the contract (possibly due to
// incorrect address) then the pollIfEligible method should create a JobErr record
func TestFluxMonitor_PollIfEligible_Creates_JobErr(t *testing.T) {
t.Parallel()
db, nodeAddr := setupStoreWithKey(t)
oracles := []common.Address{nodeAddr, testutils.NewAddress()}

Expand Down Expand Up @@ -529,6 +531,7 @@ func TestFluxMonitor_PollIfEligible_Creates_JobErr(t *testing.T) {
}

func TestPollingDeviationChecker_BuffersLogs(t *testing.T) {
t.Parallel()
db, nodeAddr := setupStoreWithKey(t)
oracles := []common.Address{nodeAddr, testutils.NewAddress()}

Expand Down Expand Up @@ -728,6 +731,7 @@ func TestPollingDeviationChecker_BuffersLogs(t *testing.T) {
}

func TestFluxMonitor_TriggerIdleTimeThreshold(t *testing.T) {
t.Parallel()
g := gomega.NewWithT(t)

testCases := []struct {
Expand Down Expand Up @@ -904,6 +908,7 @@ func TestFluxMonitor_HibernationTickerFiresMultipleTimes(t *testing.T) {
}

func TestFluxMonitor_HibernationIsEnteredAndRetryTickerStopped(t *testing.T) {
t.Parallel()
db, nodeAddr := setupFullDBWithKey(t)
oracles := []common.Address{nodeAddr, testutils.NewAddress()}

Expand Down Expand Up @@ -1173,6 +1178,7 @@ func TestFluxMonitor_RoundTimeoutCausesPoll_timesOutAtZero(t *testing.T) {
}

func TestFluxMonitor_UsesPreviousRoundStateOnStartup_RoundTimeout(t *testing.T) {
t.Parallel()
g := gomega.NewWithT(t)

db, nodeAddr := setupStoreWithKey(t)
Expand Down Expand Up @@ -1234,6 +1240,7 @@ func TestFluxMonitor_UsesPreviousRoundStateOnStartup_RoundTimeout(t *testing.T)
}

func TestFluxMonitor_UsesPreviousRoundStateOnStartup_IdleTimer(t *testing.T) {
t.Parallel()
g := gomega.NewWithT(t)

db, nodeAddr := setupStoreWithKey(t)
Expand Down Expand Up @@ -1433,6 +1440,7 @@ func TestFluxMonitor_ConsumeLogBroadcast_Error(t *testing.T) {
}

func TestFluxMonitor_DoesNotDoubleSubmit(t *testing.T) {
t.Parallel()
t.Run("when NewRound log arrives, then poll ticker fires", func(t *testing.T) {
db, nodeAddr := setupStoreWithKey(t)
oracles := []common.Address{nodeAddr, testutils.NewAddress()}
Expand Down
2 changes: 2 additions & 0 deletions core/services/fluxmonitorv2/payment_checker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
)

func TestPaymentChecker_SufficientFunds(t *testing.T) {
t.Parallel()
var (
checker = fluxmonitorv2.NewPaymentChecker(nil, nil)
payment = 100
Expand Down Expand Up @@ -44,6 +45,7 @@ func TestPaymentChecker_SufficientFunds(t *testing.T) {
}

func TestPaymentChecker_SufficientPayment(t *testing.T) {
t.Parallel()
var (
payment int64 = 10
eq = payment
Expand Down
14 changes: 14 additions & 0 deletions core/services/fluxmonitorv2/poll_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func watchTicks(t *testing.T, pm *fluxmonitorv2.PollManager, waitDuration time.D
}

func TestPollManager_PollTicker(t *testing.T) {
t.Parallel()
pm, err := fluxmonitorv2.NewPollManager(fluxmonitorv2.PollManagerConfig{
PollTickerInterval: pollTickerDefaultDuration,
PollTickerDisabled: false,
Expand All @@ -104,6 +105,7 @@ func TestPollManager_PollTicker(t *testing.T) {
}

func TestPollManager_IdleTimer(t *testing.T) {
t.Parallel()
pm, err := fluxmonitorv2.NewPollManager(fluxmonitorv2.PollManagerConfig{
PollTickerInterval: 100 * time.Millisecond,
PollTickerDisabled: true,
Expand All @@ -126,6 +128,7 @@ func TestPollManager_IdleTimer(t *testing.T) {
}

func TestPollManager_RoundTimer(t *testing.T) {
t.Parallel()
pm, err := fluxmonitorv2.NewPollManager(fluxmonitorv2.PollManagerConfig{
PollTickerInterval: pollTickerDefaultDuration,
PollTickerDisabled: true,
Expand All @@ -149,6 +152,7 @@ func TestPollManager_RoundTimer(t *testing.T) {
}

func TestPollManager_RetryTimer(t *testing.T) {
t.Parallel()
pm, err := fluxmonitorv2.NewPollManager(fluxmonitorv2.PollManagerConfig{
PollTickerInterval: pollTickerDefaultDuration,
PollTickerDisabled: true,
Expand Down Expand Up @@ -185,6 +189,7 @@ func TestPollManager_RetryTimer(t *testing.T) {
}

func TestPollManager_InitialPoll(t *testing.T) {
t.Parallel()
pm := newPollManager(t)
pm.Start(false, flux_aggregator_wrapper.OracleRoundState{})

Expand All @@ -193,6 +198,7 @@ func TestPollManager_InitialPoll(t *testing.T) {
}

func TestPollManager_HibernationTimer(t *testing.T) {
t.Parallel()
pm, err := fluxmonitorv2.NewPollManager(fluxmonitorv2.PollManagerConfig{
PollTickerInterval: pollTickerDefaultDuration,
PollTickerDisabled: true,
Expand All @@ -214,6 +220,7 @@ func TestPollManager_HibernationTimer(t *testing.T) {
}

func TestPollManager_HibernationOnStartThenAwaken(t *testing.T) {
t.Parallel()
pm, err := fluxmonitorv2.NewPollManager(fluxmonitorv2.PollManagerConfig{
PollTickerInterval: pollTickerDefaultDuration,
PollTickerDisabled: false,
Expand Down Expand Up @@ -248,6 +255,7 @@ func TestPollManager_HibernationOnStartThenAwaken(t *testing.T) {
}

func TestPollManager_AwakeOnStartThenHibernate(t *testing.T) {
t.Parallel()
pm := newPollManager(t)

pm.Start(false, flux_aggregator_wrapper.OracleRoundState{
Expand All @@ -272,6 +280,7 @@ func TestPollManager_AwakeOnStartThenHibernate(t *testing.T) {
}

func TestPollManager_ShouldPerformInitialPoll(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
pollTickerDisabled bool
Expand Down Expand Up @@ -339,6 +348,7 @@ func TestPollManager_ShouldPerformInitialPoll(t *testing.T) {
}

func TestPollManager_Stop(t *testing.T) {
t.Parallel()
pm := newPollManager(t)

pm.Start(false, flux_aggregator_wrapper.OracleRoundState{
Expand All @@ -362,6 +372,7 @@ func TestPollManager_Stop(t *testing.T) {
}

func TestPollManager_ResetIdleTimer(t *testing.T) {
t.Parallel()
pm := newPollManager(t)

// Start again in awake mode
Expand All @@ -382,6 +393,7 @@ func TestPollManager_ResetIdleTimer(t *testing.T) {
}

func TestPollManager_ResetIdleTimerWhenHibernating(t *testing.T) {
t.Parallel()
pm := newPollManager(t)

// Start in hibernation
Expand All @@ -402,6 +414,7 @@ func TestPollManager_ResetIdleTimerWhenHibernating(t *testing.T) {
}

func TestPollManager_Reset(t *testing.T) {
t.Parallel()
pm := newPollManager(t)

// Start again in awake mode
Expand Down Expand Up @@ -429,6 +442,7 @@ func TestPollManager_Reset(t *testing.T) {
}

func TestPollManager_ResetWhenHibernating(t *testing.T) {
t.Parallel()
pm := newPollManager(t)

// Start in hibernation
Expand Down
1 change: 1 addition & 0 deletions core/services/fluxmonitorv2/submission_checker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
)

func TestSubmissionChecker_IsValid(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
answer decimal.Decimal
Expand Down
1 change: 1 addition & 0 deletions core/services/fluxmonitorv2/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func (testcfg) DefaultHTTPTimeout() commonconfig.Duration {
}

func TestValidate(t *testing.T) {
t.Parallel()
var tt = []struct {
name string
toml string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ func TestORM_UpsertSubscription(t *testing.T) {
})
}
func Test_NewORM(t *testing.T) {
t.Parallel()
t.Run("OK-create_ORM", func(t *testing.T) {
_, err := subscriptions.NewORM(pgtest.NewSqlxDB(t), logger.TestLogger(t), testutils.NewAddress())
require.NoError(t, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const (
)

func TestSubscriptions_OnePass(t *testing.T) {
t.Parallel()
getSubscriptionCount := hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000003")
getSubscriptionsInRange := hexutil.MustDecode("0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000240000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000109e6e1b12098cc8f3a1e9719a817ec53ab9b35c000000000000000000000000000000000000000000000000000034e23f515cb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000f5340f0968ee8b7dfd97e3327a6139273cc2c4fa000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000009ed925d8206a4f88a2f643b28b3035b315753cd60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001bc14b92364c75e20000000000000000000000009ed925d8206a4f88a2f643b28b3035b315753cd60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000005439e5881a529f3ccbffc0e82d49f9db3950aefe")

Expand Down Expand Up @@ -72,6 +73,7 @@ func TestSubscriptions_OnePass(t *testing.T) {
}

func TestSubscriptions_MultiPass(t *testing.T) {
t.Parallel()
const ncycles int32 = 5
var currentCycle atomic.Int32
getSubscriptionCount := hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000006")
Expand Down Expand Up @@ -119,6 +121,7 @@ func TestSubscriptions_MultiPass(t *testing.T) {
}

func TestSubscriptions_Stored(t *testing.T) {
t.Parallel()
getSubscriptionCount := hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000003")
getSubscriptionsInRange := hexutil.MustDecode("0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000240000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000109e6e1b12098cc8f3a1e9719a817ec53ab9b35c000000000000000000000000000000000000000000000000000034e23f515cb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000f5340f0968ee8b7dfd97e3327a6139273cc2c4fa000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000009ed925d8206a4f88a2f643b28b3035b315753cd60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001bc14b92364c75e20000000000000000000000009ed925d8206a4f88a2f643b28b3035b315753cd60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000005439e5881a529f3ccbffc0e82d49f9db3950aefe")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ answer;
`

func TestAdapter_Integration(t *testing.T) {
testutils.SkipShortDB(t)
logger := logger.TestLogger(t)
cfg := configtest.NewTestGeneralConfig(t)
url := cfg.Database().URL()
Expand Down
Loading

0 comments on commit aa57182

Please sign in to comment.