Skip to content

Commit 9c4ea40

Browse files
committed
Add option to disable hack in tests (to not pollute the test results)
1 parent 622c011 commit 9c4ea40

2 files changed

Lines changed: 28 additions & 16 deletions

File tree

core/capabilities/integration_tests/keystone/securemint_workflow_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ import (
2121
)
2222

2323
// Test_runSecureMintWorkflow can be run with:
24+
<<<<<<< HEAD
2425
// `CL_DATABASE_URL=postgresql://chainlink_dev:insecurepassword@localhost:5432/chainlink_development_test?sslmode=disable go test -timeout 2m -run ^Test_runSecureMintWorkflow$ github.com/smartcontractkit/chainlink/v2/core/capabilities/integration_tests/keystone -v 2>&1 | tee all.log | awk '/DEBUG|INFO|WARN|ERROR/ { print > "node_logs.log"; next }; { print > "other.log" }'; tail all.log`
26+
||||||| parent of b38bd132e7 (Add option to disable hack in tests (to not pollute the test results))
27+
=======
28+
// `SECURE_TRANSMITTER_HACK_DISABLED=true CL_DATABASE_URL=postgresql://chainlink_dev:insecurepassword@localhost:5432/chainlink_development_test?sslmode=disable go test -timeout 2m -run ^Test_runSecureMintWorkflow$ github.com/smartcontractkit/chainlink/v2/core/capabilities/integration_tests/keystone`
29+
>>>>>>> b38bd132e7 (Add option to disable hack in tests (to not pollute the test results))
2530
func Test_runSecureMintWorkflow(t *testing.T) {
2631
ctx := t.Context()
2732
lggr := logger.Test(t)

core/services/chainlink/application.go

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"io"
99
"math/big"
1010
"net/http"
11+
"os"
1112
"strconv"
1213
"sync"
1314
"time"
@@ -72,7 +73,7 @@ import (
7273
"github.com/smartcontractkit/chainlink/v2/core/services/nodestatusreporter/bridgestatus"
7374
"github.com/smartcontractkit/chainlink/v2/core/services/ocr"
7475
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2"
75-
securemint "github.com/smartcontractkit/chainlink/v2/core/services/ocr3/securemint"
76+
"github.com/smartcontractkit/chainlink/v2/core/services/ocr3/securemint"
7677
"github.com/smartcontractkit/chainlink/v2/core/services/ocrbootstrap"
7778
"github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon"
7879
p2ptypes "github.com/smartcontractkit/chainlink/v2/core/services/p2p/types"
@@ -1116,22 +1117,28 @@ func newCREServices(
11161117
opts.CapabilitiesRegistry.SetLocalRegistry(&capabilities.TestMetadataRegistry{})
11171118
}
11181119

1119-
globalLogger.Infow("HACK: initializing Secure Mint transmitter for sending mock secure mint trigger events")
1120-
transmitterConfig := securemint.TransmitterConfig{
1121-
Logger: globalLogger,
1122-
CapabilitiesRegistry: opts.CapabilitiesRegistry,
1123-
DonID: 1,
1124-
TriggerCapabilityName: "securemint-trigger",
1125-
TriggerCapabilityVersion: "1.0.0",
1126-
TriggerTickerMinResolutionMs: 1000,
1127-
TriggerSendChannelBufferSize: 1000,
1128-
}
1129-
transmitter, err := transmitterConfig.NewTransmitter("securemint-transmitter")
1130-
if err != nil {
1131-
globalLogger.Errorw("could not create Secure Mint transmitter, skipping", "error", err)
1120+
// enable hack unless it's specifically disabled on the environment (e.g. for tests)
1121+
secureMintTransmitterHackDisabled, ok := os.LookupEnv("SECURE_TRANSMITTER_HACK_DISABLED")
1122+
if !ok || secureMintTransmitterHackDisabled != "true" {
1123+
globalLogger.Infow("HACK: initializing Secure Mint transmitter for sending mock secure mint trigger events")
1124+
transmitterConfig := securemint.TransmitterConfig{
1125+
Logger: globalLogger,
1126+
CapabilitiesRegistry: opts.CapabilitiesRegistry,
1127+
DonID: 1,
1128+
TriggerCapabilityName: "securemint-trigger",
1129+
TriggerCapabilityVersion: "1.0.0",
1130+
TriggerTickerMinResolutionMs: 1000,
1131+
TriggerSendChannelBufferSize: 1000,
1132+
}
1133+
transmitter, err := transmitterConfig.NewTransmitter("securemint-transmitter")
1134+
if err != nil {
1135+
globalLogger.Errorw("could not create Secure Mint transmitter, skipping", "error", err)
1136+
} else {
1137+
srvcs = append(srvcs, transmitter)
1138+
globalLogger.Infow("HACK: successfully created Secure Mint transmitter")
1139+
}
11321140
} else {
1133-
srvcs = append(srvcs, transmitter)
1134-
globalLogger.Infow("HACK: successfully created Secure Mint transmitter")
1141+
globalLogger.Infow("HACK: Secure Mint transmitter hack disabled, skipping")
11351142
}
11361143

11371144
return &CREServices{

0 commit comments

Comments
 (0)