From d6272f54e7916e96e5b1c9ff056bd7049fc7828f Mon Sep 17 00:00:00 2001 From: bendanzhentan <455462586@qq.com> Date: Fri, 13 Oct 2023 09:42:57 +0800 Subject: [PATCH 1/2] test: add unit-test.yaml --- .github/workflows/unit-test.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/unit-test.yaml diff --git a/.github/workflows/unit-test.yaml b/.github/workflows/unit-test.yaml new file mode 100644 index 0000000000..ebb619649b --- /dev/null +++ b/.github/workflows/unit-test.yaml @@ -0,0 +1,18 @@ +name: Unit Test + +on: + pull_request: + types: [ opened, synchronize, reopened ] + push: + branches: [main, develop] + +jobs: + unit_test: + name: unit_test + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v4 + with: + go-version: '^1.21.3' + - run: make test From 417204887989cb8e64e3cfefc0ee23b7c217f4a4 Mon Sep 17 00:00:00 2001 From: bendanzhentan <455462586@qq.com> Date: Tue, 17 Oct 2023 11:17:56 +0800 Subject: [PATCH 2/2] ethclient: ensure the close of canceled context --- ethclient/ethclient_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/ethclient/ethclient_test.go b/ethclient/ethclient_test.go index c22446f6f3..0ec2f9e97a 100644 --- a/ethclient/ethclient_test.go +++ b/ethclient/ethclient_test.go @@ -491,6 +491,7 @@ func testTransactionInBlockInterrupted(t *testing.T, client *rpc.Client) { // Test tx in block interrupted. ctx, cancel := context.WithCancel(context.Background()) cancel() + <-ctx.Done() tx, err := ec.TransactionInBlock(ctx, block.Hash(), 0) if tx != nil { t.Fatal("transaction should be nil")