From 0f66ccb6dc35ce174532557cfb239dacf43cb6fa Mon Sep 17 00:00:00 2001 From: sunspirit <167175638+linhpn99@users.noreply.github.com> Date: Wed, 10 Jul 2024 04:26:30 +0700 Subject: [PATCH] test(gnoclient): Fix a potential bug in the integration test (#2558) ![Screenshot from 2024-07-09 21-48-59](https://github.com/gnolang/gno/assets/167175638/a4429fb7-c277-4296-86fb-f55dfaa924ca) I'm not sure about the root cause, but it seems like the test node isn't ready to handle the request call, so it returns an error. Using the result immediately without asserting that there's no error will cause this section to panic, leading to a CI that fails randomly You can see https://github.com/gnolang/gno/actions/runs/9855164413/job/27209502761?pr=2518
Contributors' checklist... - [ ] Added new tests, or not needed, or not feasible - [ ] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [ ] Updated the official documentation or not needed - [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [ ] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests - [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
--------- Co-authored-by: Morgan --- gno.land/pkg/gnoclient/integration_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gno.land/pkg/gnoclient/integration_test.go b/gno.land/pkg/gnoclient/integration_test.go index 9bcba7997ae..06360244b7f 100644 --- a/gno.land/pkg/gnoclient/integration_test.go +++ b/gno.land/pkg/gnoclient/integration_test.go @@ -53,11 +53,11 @@ func TestCallSingle_Integration(t *testing.T) { // Execute call res, err := client.Call(baseCfg, msg) + require.NoError(t, err) expected := "(\"hi test argument\" string)\n\n" got := string(res.DeliverTx.Data) - assert.Nil(t, err) assert.Equal(t, expected, got) } @@ -107,9 +107,9 @@ func TestCallMultiple_Integration(t *testing.T) { // Execute call res, err := client.Call(baseCfg, msg1, msg2) + require.NoError(t, err) got := string(res.DeliverTx.Data) - assert.Nil(t, err) assert.Equal(t, expected, got) } @@ -149,12 +149,12 @@ func TestSendSingle_Integration(t *testing.T) { // Execute send res, err := client.Send(baseCfg, msg) - assert.Nil(t, err) + require.NoError(t, err) assert.Equal(t, "", string(res.DeliverTx.Data)) // Get the new account balance account, _, err := client.QueryAccount(toAddress) - assert.Nil(t, err) + require.NoError(t, err) expected := std.Coins{{"ugnot", int64(amount)}} got := account.GetCoins() @@ -409,7 +409,7 @@ func Echo(str string) string { // Execute AddPackage _, err = client.AddPackage(baseCfg, msg) - assert.Nil(t, err) + assert.NoError(t, err) // Check for deployed file on the node query, err := client.Query(QueryCfg{ @@ -501,7 +501,7 @@ func Hello(str string) string { // Execute AddPackage _, err = client.AddPackage(baseCfg, msg1, msg2) - assert.Nil(t, err) + assert.NoError(t, err) // Check Package #1 query, err := client.Query(QueryCfg{