Skip to content

Commit

Permalink
Remove legacy chains from tests that used it for job orm
Browse files Browse the repository at this point in the history
  • Loading branch information
ilija42 committed Nov 1, 2023
1 parent cb930b8 commit 988d614
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 109 deletions.
3 changes: 1 addition & 2 deletions core/internal/features/features_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,7 @@ observationSource = """

pipelineORM := pipeline.NewORM(app.GetSqlxDB(), logger.TestLogger(t), cfg.Database(), cfg.JobPipeline().MaxSuccessfulRuns())
bridgeORM := bridges.NewORM(app.GetSqlxDB(), logger.TestLogger(t), cfg.Database())
legacyChains := app.GetRelayers().LegacyEVMChains()
jobORM := job.NewORM(app.GetSqlxDB(), legacyChains, pipelineORM, bridgeORM, app.KeyStore, logger.TestLogger(t), cfg.Database())
jobORM := job.NewORM(app.GetSqlxDB(), pipelineORM, bridgeORM, app.KeyStore, logger.TestLogger(t), cfg.Database())

runs := cltest.WaitForPipelineComplete(t, 0, jobID, 1, 2, jobORM, 5*time.Second, 300*time.Millisecond)
require.Len(t, runs, 1)
Expand Down
6 changes: 1 addition & 5 deletions core/services/cron/cron_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/internal/cltest"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils/pgtest"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/cron"
"github.com/smartcontractkit/chainlink/v2/core/services/job"
"github.com/smartcontractkit/chainlink/v2/core/services/pipeline"
pipelinemocks "github.com/smartcontractkit/chainlink/v2/core/services/pipeline/mocks"
evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm"
)

func TestCronV2Pipeline(t *testing.T) {
Expand All @@ -28,12 +26,10 @@ func TestCronV2Pipeline(t *testing.T) {
db := pgtest.NewSqlxDB(t)

keyStore := cltest.NewKeyStore(t, db, cfg.Database())
relayerExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, Client: evmtest.NewEthClientMockWithDefaultChain(t), KeyStore: keyStore.Eth()})
lggr := logger.TestLogger(t)
orm := pipeline.NewORM(db, lggr, cfg.Database(), cfg.JobPipeline().MaxSuccessfulRuns())
btORM := bridges.NewORM(db, lggr, cfg.Database())
legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayerExtenders)
jobORM := job.NewORM(db, legacyChains, orm, btORM, keyStore, lggr, cfg.Database())
jobORM := job.NewORM(db, orm, btORM, keyStore, lggr, cfg.Database())

jb := &job.Job{
Type: job.Cron,
Expand Down
2 changes: 1 addition & 1 deletion core/services/directrequest/delegate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ func NewDirectRequestUniverseWithConfig(t *testing.T, cfg chainlink.GeneralConfi
lggr := logger.TestLogger(t)
orm := pipeline.NewORM(db, lggr, cfg.Database(), cfg.JobPipeline().MaxSuccessfulRuns())
btORM := bridges.NewORM(db, lggr, cfg.Database())
jobORM := job.NewORM(db, orm, btORM, keyStore, lggr, cfg.Database())
legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders)
jobORM := job.NewORM(db, legacyChains, orm, btORM, keyStore, lggr, cfg.Database())
delegate := directrequest.NewDelegate(lggr, runner, orm, legacyChains, mailMon)

jb := cltest.MakeDirectRequestJobSpec(t)
Expand Down
4 changes: 2 additions & 2 deletions core/services/feeds/orm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1656,8 +1656,7 @@ func createJob(t *testing.T, db *sqlx.DB, externalJobID uuid.UUID) *job.Job {
bridgeORM = bridges.NewORM(db, lggr, config.Database())
relayExtenders = evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()})
)
legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders)
orm := job.NewORM(db, legacyChains, pipelineORM, bridgeORM, keyStore, lggr, config.Database())
orm := job.NewORM(db, pipelineORM, bridgeORM, keyStore, lggr, config.Database())
require.NoError(t, keyStore.OCR().Add(cltest.DefaultOCRKey))
require.NoError(t, keyStore.P2P().Add(cltest.DefaultP2PKey))

Expand All @@ -1667,6 +1666,7 @@ func createJob(t *testing.T, db *sqlx.DB, externalJobID uuid.UUID) *job.Job {
_, bridge2 := cltest.MustCreateBridge(t, db, cltest.BridgeOpts{}, config.Database())

_, address := cltest.MustInsertRandomKey(t, keyStore.Eth())
legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders)
jb, err := ocr.ValidatedOracleSpecToml(legacyChains,
testspecs.GenerateOCRSpec(testspecs.OCRSpecParams{
JobID: externalJobID.String(),
Expand Down
6 changes: 1 addition & 5 deletions core/services/fluxmonitorv2/orm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/internal/cltest"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils/pgtest"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/fluxmonitorv2"
"github.com/smartcontractkit/chainlink/v2/core/services/job"
"github.com/smartcontractkit/chainlink/v2/core/services/pipeline"
evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm"
"github.com/smartcontractkit/chainlink/v2/core/utils"
)

Expand Down Expand Up @@ -96,11 +94,9 @@ func TestORM_UpdateFluxMonitorRoundStats(t *testing.T) {
pipelineORM := pipeline.NewORM(db, lggr, cfg.Database(), cfg.JobPipeline().MaxSuccessfulRuns())
bridgeORM := bridges.NewORM(db, lggr, cfg.Database())

relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{GeneralConfig: cfg, DB: db, KeyStore: keyStore.Eth()})
legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders)
// Instantiate a real job ORM because we need to create a job to satisfy
// a check in pipeline.CreateRun
jobORM := job.NewORM(db, legacyChains, pipelineORM, bridgeORM, keyStore, lggr, cfg.Database())
jobORM := job.NewORM(db, pipelineORM, bridgeORM, keyStore, lggr, cfg.Database())
orm := newORM(t, db, cfg.Database(), nil)

address := testutils.NewAddress()
Expand Down
Loading

0 comments on commit 988d614

Please sign in to comment.