Skip to content

Commit

Permalink
[BCF-2710] Randomize external_initiators.name (#11036)
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-cordenier authored Oct 23, 2023
1 parent 35057f1 commit 5211322
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
4 changes: 3 additions & 1 deletion core/bridges/external_initiator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package bridges_test
import (
"testing"

"github.com/google/uuid"
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink/v2/core/auth"
Expand All @@ -18,8 +19,9 @@ func TestNewExternalInitiator(t *testing.T) {
assert.Len(t, eia.Secret, 64)

url := cltest.WebURL(t, "http://localhost:8888")
name := uuid.New().String()
eir := &bridges.ExternalInitiatorRequest{
Name: "bitcoin",
Name: name,
URL: &url,
}
ei, err := bridges.NewExternalInitiator(eia, eir)
Expand Down
7 changes: 5 additions & 2 deletions core/bridges/orm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"testing"
"time"

"github.com/google/uuid"
"github.com/smartcontractkit/sqlx"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -159,8 +160,9 @@ func TestORM_CreateExternalInitiator(t *testing.T) {
_, orm := setupORM(t)

token := auth.NewToken()
name := uuid.New().String()
req := bridges.ExternalInitiatorRequest{
Name: "externalinitiator",
Name: name,
}
exi, err := bridges.NewExternalInitiator(token, &req)
require.NoError(t, err)
Expand All @@ -175,8 +177,9 @@ func TestORM_DeleteExternalInitiator(t *testing.T) {
_, orm := setupORM(t)

token := auth.NewToken()
name := uuid.New().String()
req := bridges.ExternalInitiatorRequest{
Name: "externalinitiator",
Name: name,
}
exi, err := bridges.NewExternalInitiator(token, &req)
require.NoError(t, err)
Expand Down
3 changes: 2 additions & 1 deletion core/cmd/shell_remote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"testing"
"time"

"github.com/google/uuid"
"github.com/kylelemons/godebug/diff"
"github.com/pelletier/go-toml"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -220,7 +221,7 @@ func TestShell_DestroyExternalInitiator(t *testing.T) {

token := auth.NewToken()
exi, err := bridges.NewExternalInitiator(token,
&bridges.ExternalInitiatorRequest{Name: "name"},
&bridges.ExternalInitiatorRequest{Name: uuid.New().String()},
)
require.NoError(t, err)
err = app.BridgeORM().CreateExternalInitiator(exi)
Expand Down
4 changes: 3 additions & 1 deletion core/web/ping_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"strings"
"testing"

"github.com/google/uuid"

"github.com/smartcontractkit/chainlink/v2/core/auth"
"github.com/smartcontractkit/chainlink/v2/core/bridges"
"github.com/smartcontractkit/chainlink/v2/core/internal/cltest"
Expand Down Expand Up @@ -43,7 +45,7 @@ func TestPingController_Show_ExternalInitiatorCredentials(t *testing.T) {
}
eir_url := cltest.WebURL(t, "http://localhost:8888")
eir := &bridges.ExternalInitiatorRequest{
Name: "bitcoin",
Name: uuid.New().String(),
URL: &eir_url,
}

Expand Down
6 changes: 4 additions & 2 deletions core/web/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"net/http/httptest"
"testing"

"github.com/google/uuid"

"github.com/smartcontractkit/chainlink/v2/core/auth"
"github.com/smartcontractkit/chainlink/v2/core/bridges"
"github.com/smartcontractkit/chainlink/v2/core/internal/cltest"
Expand Down Expand Up @@ -57,7 +59,7 @@ func TestTokenAuthRequired_TokenCredentials(t *testing.T) {
eia := auth.NewToken()
url := cltest.WebURL(t, "http://localhost:8888")
eir := &bridges.ExternalInitiatorRequest{
Name: "bitcoin",
Name: uuid.New().String(),
URL: &url,
}
ea, err := bridges.NewExternalInitiator(eia, eir)
Expand Down Expand Up @@ -89,7 +91,7 @@ func TestTokenAuthRequired_BadTokenCredentials(t *testing.T) {
eia := auth.NewToken()
url := cltest.WebURL(t, "http://localhost:8888")
eir := &bridges.ExternalInitiatorRequest{
Name: "bitcoin",
Name: uuid.New().String(),
URL: &url,
}
ea, err := bridges.NewExternalInitiator(eia, eir)
Expand Down

0 comments on commit 5211322

Please sign in to comment.