Skip to content

Commit

Permalink
fix environment building
Browse files Browse the repository at this point in the history
  • Loading branch information
AnieeG committed Sep 4, 2024
1 parent a86ef26 commit 0f42e6b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
8 changes: 5 additions & 3 deletions integration-tests/deployment/devenv/don.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

"github.com/AlekSi/pointer"
"github.com/hashicorp/go-multierror"
"github.com/rs/zerolog"

clclient "github.com/smartcontractkit/chainlink/integration-tests/client"
csav1 "github.com/smartcontractkit/chainlink/integration-tests/deployment/jd/csa/v1"
Expand All @@ -25,9 +24,10 @@ type NodeInfo struct {
type DON struct {
Bootstrap []Node
Nodes []Node
JDId string
}

func NewRegisteredDON(ctx context.Context, logger zerolog.Logger, nodeInfo []NodeInfo, jd JobDistributor) (*DON, error) {
func NewRegisteredDON(ctx context.Context, nodeInfo []NodeInfo, jd JobDistributor) (*DON, error) {
don := &DON{
Bootstrap: make([]Node, 0),
Nodes: make([]Node, 0),
Expand Down Expand Up @@ -62,7 +62,9 @@ func NewRegisteredDON(ctx context.Context, logger zerolog.Logger, nodeInfo []Nod
} else {
don.Nodes = append(don.Nodes, *node)
}
don.JDId = jdId
}
return don, nil
}

func NewNode(nodeInfo NodeInfo) (*Node, error) {
Expand All @@ -81,8 +83,8 @@ func NewNode(nodeInfo NodeInfo) (*Node, error) {
}

type Node struct {
gqlClient client.Client
NodeId string
gqlClient client.Client
labels []*ptypes.Label
name string
adminAddr string
Expand Down
22 changes: 13 additions & 9 deletions integration-tests/deployment/devenv/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import (
"context"
"fmt"

"github.com/smartcontractkit/ccip/integration-tests/deployment"
csav1 "github.com/smartcontractkit/ccip/integration-tests/deployment/jd/csa/v1"
"github.com/smartcontractkit/chainlink/integration-tests/deployment"
"github.com/smartcontractkit/chainlink/v2/core/logger"
)

Expand All @@ -15,7 +14,7 @@ const (

type EnvironmentConfig struct {
Chains []ChainConfig
DON DON
nodeInfo []NodeInfo
JDConfig JDConfig
}

Expand All @@ -29,15 +28,20 @@ func NewEnvironment(ctx context.Context, lggr logger.Logger, config EnvironmentC
return nil, fmt.Errorf("failed to create JD client: %w", err)
}

keypairs, err := offChain.ListKeypairs(ctx, &csav1.ListKeypairsRequest{})
jd, ok := offChain.(JobDistributor)
if !ok {
return nil, fmt.Errorf("offchain client does not implement JobDistributor")
}
don, err := NewRegisteredDON(ctx, config.nodeInfo, jd)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to create registered DON: %w", err)
}

nodes := NewNodes(t, chains, config.Nodes, config.Bootstraps, config.RegistryConfig)
var nodeIDs []string
for id := range nodes {
nodeIDs = append(nodeIDs, id)
for _, node := range don.Bootstrap {
nodeIDs = append(nodeIDs, node.NodeId)
}
for _, node := range don.Nodes {
nodeIDs = append(nodeIDs, node.NodeId)
}

return &deployment.Environment{
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/deployment/devenv/jd.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import (

type JDConfig struct {
URL string
Creds credentials.TransportCredentials
creds credentials.TransportCredentials
}

func NewClientConnection(cfg JDConfig) (*grpc.ClientConn, error) {
var opts []grpc.DialOption
// TODO: add auth details
if cfg.Creds != nil {
opts = append(opts, grpc.WithTransportCredentials(cfg.Creds))
if cfg.creds != nil {
opts = append(opts, grpc.WithTransportCredentials(cfg.creds))
} else {
opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))

Expand Down

0 comments on commit 0f42e6b

Please sign in to comment.