44 "encoding/json"
55 "fmt"
66 "os"
7+ "time"
78
89 ocr2_config "github.com/smartcontractkit/chainlink-solana/integration-tests/config"
910
@@ -143,6 +144,26 @@ func (sg *SolanaGauntlet) exec(args []string, options gauntlet.ExecCommandOption
143144 return out , err
144145}
145146
147+ func (sg * SolanaGauntlet ) execWithRetries (args []string , options gauntlet.ExecCommandOptions ) (string , error ) {
148+ updatedArgs := []string {"--cwd" , sg .Dir , sg .G .Command , args [0 ], sg .G .Flag ("network" , sg .G .Network )}
149+ if len (args ) > 1 {
150+ updatedArgs = append (updatedArgs , args [1 :]... )
151+ }
152+
153+ if options .RetryCount == 0 {
154+ options .RetryCount = 4
155+ }
156+ if options .RetryDelay == 0 {
157+ options .RetryDelay = 2 * time .Second
158+ }
159+
160+ out , err := sg .G .ExecCommandWithRetries (updatedArgs , options )
161+ if err != nil {
162+ err = fmt .Errorf ("%w\n gauntlet command: %s\n stdout: %s" , err , updatedArgs , out )
163+ }
164+ return out , err
165+ }
166+
146167func (sg * SolanaGauntlet ) InitializeAccessController () (string , error ) {
147168 _ , err := sg .exec ([]string {"access_controller:initialize" }, * sg .options )
148169 if err != nil {
@@ -156,14 +177,26 @@ func (sg *SolanaGauntlet) InitializeAccessController() (string, error) {
156177}
157178
158179func (sg * SolanaGauntlet ) DeployLinkToken () error {
159- _ , err := sg .exec ([]string {"token:deploy" }, * sg .options )
180+ opts := * sg .options
181+ opts .RetryCount = 4
182+ opts .RetryDelay = 2 * time .Second
183+
184+ _ , err := sg .execWithRetries ([]string {"token:deploy" }, opts )
160185 if err != nil {
161186 return err
162187 }
163188 sg .gr , err = sg .FetchGauntletJSONOutput ()
164189 if err != nil {
165190 return err
166191 }
192+
193+ if sg .gr .Data .Vault == nil || * sg .gr .Data .Vault == "" {
194+ return fmt .Errorf ("token:deploy succeeded but vault address missing in report.json" )
195+ }
196+ if len (sg .gr .Responses ) == 0 || sg .gr .Responses [0 ].Contract == "" {
197+ return fmt .Errorf ("token:deploy succeeded but link token address missing in report.json" )
198+ }
199+
167200 sg .VaultAddress = * sg .gr .Data .Vault
168201 sg .LinkAddress = sg .gr .Responses [0 ].Contract
169202
0 commit comments