Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions integration_tests/consensus/consensus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import (

"github.com/smartcontractkit/chainlink-common/pkg/beholder/beholdertest"
commoncap "github.com/smartcontractkit/chainlink-common/pkg/capabilities"
"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/services/servicetest"
"github.com/smartcontractkit/chainlink-common/pkg/workflows"
events2 "github.com/smartcontractkit/chainlink-protos/workflows/go/events"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/integration_tests/framework"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/gateway/handlers/capabilities"

"github.com/smartcontractkit/capabilities/integration_tests/utils"
Expand All @@ -30,10 +30,8 @@ func Test_Consensus(t *testing.T) {
ctx := t.Context()
beholderTester := beholdertest.NewObserver(t)

lggr := logger.TestLogger(t)
defer func() {
utils.CleanupCapabilitiesDir(lggr)
}()
lggr := logger.Test(t)
t.Cleanup(utils.RemoveCapabilitiesDir(t))

readBalancesWithConfigPath, err := filepath.Abs("./workflow")
require.NoError(t, err)
Expand Down
8 changes: 3 additions & 5 deletions integration_tests/cron/cron_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/integration_tests/framework"
"github.com/smartcontractkit/chainlink/v2/core/logger"

"github.com/smartcontractkit/capabilities/integration_tests/utils"
)
Expand All @@ -27,10 +27,8 @@ type Payload struct {
func Test_CronTrigger(t *testing.T) {
t.Skip("skipping broken test")
ctx := t.Context()
lggr := logger.TestLogger(t)
defer func() {
utils.CleanupCapabilitiesDir(lggr)
}()
lggr := logger.Test(t)
t.Cleanup(utils.RemoveCapabilitiesDir(t))

cronBinary, err := utils.DeployCapability(t, "cron")
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/cron/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"github.com/stretchr/testify/require"

commoncap "github.com/smartcontractkit/chainlink-common/pkg/capabilities"
"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/services/servicetest"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/integration_tests/framework"
"github.com/smartcontractkit/chainlink/v2/core/logger"

"github.com/smartcontractkit/capabilities/integration_tests/utils"
)
Expand Down
8 changes: 3 additions & 5 deletions integration_tests/evm/evm_logtrigger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"gopkg.in/yaml.v3"

"github.com/smartcontractkit/chainlink-common/pkg/beholder/beholdertest"
"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/utils/tests"
"github.com/smartcontractkit/chainlink/v2/core/logger"

"github.com/stretchr/testify/require"

Expand Down Expand Up @@ -308,10 +308,8 @@ func assertLogTriggerWorks(t *testing.T, eventName string, workflowName string,
verifyNonMatchingIgnored bool) {
ctx := t.Context()
beholderTester := beholdertest.NewObserver(t)
lggr, obs := logger.TestLoggerObserved(t, zapcore.InfoLevel) // change this to debug to print all logs from the trigger/log poller if needed to debug
defer func() {
utils.CleanupCapabilitiesDir(lggr)
}()
lggr, obs := logger.TestObserved(t, zapcore.InfoLevel) // change this to debug to print all logs from the trigger/log poller if needed to debug

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow this does not have parity with the core version 🤔

t.Cleanup(utils.RemoveCapabilitiesDir(t))

workflowPath, err := filepath.Abs("./workflow")
require.NoError(t, err)
Expand Down
4 changes: 1 addition & 3 deletions integration_tests/load/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ func runLoadTest(t *testing.T, numberOfNodes int, f uint8, numberOfWorkflows int
ctx := t.Context()

lggr := logger.Test(t)
defer func() {
utils.CleanupCapabilitiesDir(lggr)
}()
t.Cleanup(utils.RemoveCapabilitiesDir(t))

targetSink, registerWorkflowOnDon := setupLoadtestDON(ctx, t, lggr, numberOfNodes, f, protocolRoundTime)

Expand Down
4 changes: 1 addition & 3 deletions integration_tests/por/por_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ func Test_PORReadbalances(t *testing.T) {
ctx := t.Context()

lggr := logger.Test(t)
defer func() {
utils.CleanupCapabilitiesDir(lggr)
}()
t.Cleanup(utils.RemoveCapabilitiesDir(t))

readBalancesWithConfigPath, err := filepath.Abs("../../workflows/readbalances-with-config/cmd")
require.NoError(t, err)
Expand Down
14 changes: 5 additions & 9 deletions integration_tests/readcontract/readcontract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import (
beholderpb "github.com/smartcontractkit/chainlink-common/pkg/beholder/pb"
commoncap "github.com/smartcontractkit/chainlink-common/pkg/capabilities"
"github.com/smartcontractkit/chainlink-common/pkg/capabilities/pb"
"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/services/servicetest"
"github.com/smartcontractkit/chainlink-common/pkg/utils/tests"
kcr "github.com/smartcontractkit/chainlink-evm/gethwrappers/keystone/generated/capabilities_registry_1_1_0"
"github.com/smartcontractkit/chainlink-protos/cre/go/values"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/integration_tests/framework"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/registrysyncer"

"github.com/smartcontractkit/capabilities/integration_tests/readcontract/contract"
Expand All @@ -36,11 +36,9 @@ type ReadContractConfig struct {
func Test_RemoteReadCapabilityWithoutConsensus(t *testing.T) {
t.Skip("no longer supported")
ctx := t.Context()
lggr := logger.TestLogger(t)
lggr := logger.Test(t)

defer func() {
utils.CleanupCapabilitiesDir(lggr)
}()
t.Cleanup(utils.RemoveCapabilitiesDir(t))

targetSink := readValueFromContractFunction(ctx, t, lggr, "GetValue", 4)

Expand All @@ -62,11 +60,9 @@ func Test_RemoteReadCapabilityMisconfiguredContractError(t *testing.T) {
beholderTester := tests.Beholder(t) //nolint:staticcheck

ctx := t.Context()
lggr := logger.TestLogger(t)
lggr := logger.Test(t)

defer func() {
utils.CleanupCapabilitiesDir(lggr)
}()
t.Cleanup(utils.RemoveCapabilitiesDir(t))

numOfWorkflowNodes := 4
readValueFromContractFunction(ctx, t, lggr, "GetValue2", numOfWorkflowNodes)
Expand Down
10 changes: 10 additions & 0 deletions integration_tests/utils/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"path/filepath"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-common/pkg/logger"
Expand All @@ -31,9 +32,18 @@ func DeployCapability(t *testing.T, capabilityName string) (string, error) {
}

// CleanupCapabilitiesDir removes any capabilities built by the test
// Deprecated: Use RemoveCapabilitiesDir
func CleanupCapabilitiesDir(lggr logger.Logger) {
err := os.RemoveAll(CapabilitiesDir)
if err != nil {
lggr.Errorf("Failed to remove directory: %v", err)
}
}

// RemoveCapabilitiesDir removes any capabilities built by the test.
// To be scheduled on t.CleanUp.
func RemoveCapabilitiesDir(t *testing.T) func() {
return func() {
assert.NoError(t, os.RemoveAll(CapabilitiesDir))
}
}
Loading