Skip to content

Commit 217c1e2

Browse files
committedSep 21, 2023
bad test fixed
1 parent 61ba84f commit 217c1e2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed
 

Diff for: ‎multi_key_test.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package etherscan
22

33
import "testing"
44

5-
// TestgetKey may fail is you run test parallel
6-
func TestgetKey(t *testing.T) {
5+
// TestGetKey may fail is you run test parallel
6+
func TestGetKey(t *testing.T) {
77
countApiKey, countBackupApiKey, k := 0, 0, ""
88
for i := 0; i < 10; i++ {
99
k = api.getKey()
10+
t.Logf("key: %s", k)
1011
if apiKey == k {
1112
countApiKey++
1213
} else if backupApiKey == k {
@@ -15,6 +16,6 @@ func TestgetKey(t *testing.T) {
1516
}
1617
equal := countApiKey == 5 && countBackupApiKey == 5
1718
if !equal {
18-
t.Error("api.getKey not working")
19+
t.Errorf("api.getKey not working, expected 5 for each key, got main:%d , backup %d", countApiKey, countBackupApiKey)
1920
}
2021
}

Diff for: ‎setup_e2e_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func init() {
3535
if apiKey == "" {
3636
panic(fmt.Sprintf("API key is empty, set env variable %q with a valid API key to proceed.", apiKeyEnvName))
3737
}
38-
backupApiKey = os.Getenv(apiKeyEnvName)
38+
backupApiKey = os.Getenv(backupApiKeyEnvName)
3939
if backupApiKey == "" {
4040
log.Printf("WARN: Backup API key is empty, set env variable %q with a valid API key to proceed.", backupApiKeyEnvName)
4141
}

0 commit comments

Comments
 (0)