Skip to content

Commit

Permalink
Show job runs for disabled chains (#10401)
Browse files Browse the repository at this point in the history
* Show job runs for disabled chains

* Add changelog
  • Loading branch information
george-dorin authored Sep 4, 2023
1 parent f07c491 commit 200970a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
23 changes: 23 additions & 0 deletions core/services/job/job_orm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,7 @@ func Test_FindJobsByPipelineSpecIDs(t *testing.T) {

jb, err := directrequest.ValidatedDirectRequestSpec(testspecs.DirectRequestSpec)
require.NoError(t, err)
jb.DirectRequestSpec.EVMChainID = utils.NewBigI(0)

err = orm.CreateJob(&jb)
require.NoError(t, err)
Expand All @@ -1270,6 +1271,28 @@ func Test_FindJobsByPipelineSpecIDs(t *testing.T) {
require.NoError(t, err)
assert.Len(t, jbs, 0)
})

t.Run("with chainID disabled", func(t *testing.T) {
newCfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) {
c.EVM[0] = &evmcfg.EVMConfig{
ChainID: utils.NewBigI(0),
Enabled: ptr(false),
}
c.EVM = append(c.EVM, &evmcfg.EVMConfig{
ChainID: utils.NewBigI(123123123),
Enabled: ptr(true),
})
})
relayExtenders2 := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: newCfg, KeyStore: keyStore.Eth()})
legacyChains2, err := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders2)

require.NoError(t, err)
orm2 := NewTestORM(t, db, legacyChains2, pipelineORM, bridgesORM, keyStore, config.Database())

jbs, err := orm2.FindJobsByPipelineSpecIDs([]int32{jb.PipelineSpecID})
require.NoError(t, err)
assert.Len(t, jbs, 1)
})
}

func Test_FindPipelineRuns(t *testing.T) {
Expand Down
4 changes: 3 additions & 1 deletion core/services/job/orm.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/smartcontractkit/sqlx"

"github.com/smartcontractkit/chainlink/v2/core/bridges"
"github.com/smartcontractkit/chainlink/v2/core/chains"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm"
evmconfig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config"
"github.com/smartcontractkit/chainlink/v2/core/config"
Expand Down Expand Up @@ -1185,7 +1186,8 @@ func (o *orm) FindJobsByPipelineSpecIDs(ids []int32) ([]Job, error) {
}
for i := range jbs {
err = o.LoadEnvConfigVars(&jbs[i])
if err != nil {
//We must return the jobs even if the chainID is disabled
if err != nil && !errors.Is(err, chains.ErrNoSuchChainID) {
return err
}
}
Expand Down
4 changes: 3 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [dev]

...
### Fixed
- Fixed a bug that was preventing job runs to be displayed when the job `chainID` was disabled.


## 2.5.0 - UNRELEASED

Expand Down

0 comments on commit 200970a

Please sign in to comment.