Skip to content

Commit 64aa816

Browse files
Add ENV variable to skip network test
1 parent 45b23af commit 64aa816

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ We try to follow the coding guidelines from the Go community.
146146
- Code should be commented
147147
- Code should pass all tests: `make test`
148148

149+
#### Skipping Network-Dependent Tests
150+
151+
Some tests require network access to connect to Flow mainnet/testnet nodes. To skip these tests (e.g., in sandboxed build environments like Nix), set the `SKIP_NETWORK_TESTS` environment variable:
152+
153+
```
154+
SKIP_NETWORK_TESTS=1 make test
155+
```
156+
149157
## Releasing
150158

151159
Releasing is automated by Github actions. Release action is triggered by creating a release on Github and publishing it.

internal/test/test_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,9 @@ Seed: 1521
757757
}
758758

759759
func TestForkMode_UsesMainnetAliases(t *testing.T) {
760+
if os.Getenv("SKIP_NETWORK_TESTS") != "" {
761+
t.Skip("skipping network-dependent test")
762+
}
760763
t.Parallel()
761764

762765
_, state, _ := util.TestMocks(t)
@@ -822,6 +825,9 @@ func TestForkMode_UsesMainnetAliases(t *testing.T) {
822825
}
823826

824827
func TestForkMode_UsesTestnetAliasesExplicit(t *testing.T) {
828+
if os.Getenv("SKIP_NETWORK_TESTS") != "" {
829+
t.Skip("skipping network-dependent test")
830+
}
825831
t.Parallel()
826832

827833
_, state, _ := util.TestMocks(t)
@@ -902,6 +908,9 @@ func TestForkMode_AutodetectFailureRequiresExplicitNetwork(t *testing.T) {
902908
}
903909

904910
func TestNetworkForkResolution_Success(t *testing.T) {
911+
if os.Getenv("SKIP_NETWORK_TESTS") != "" {
912+
t.Skip("skipping network-dependent test")
913+
}
905914
t.Parallel()
906915

907916
_, state, _ := util.TestMocks(t)
@@ -1011,6 +1020,9 @@ access(all) fun testSimple() {
10111020
}
10121021

10131022
func TestNetworkForkResolution_WithOwnHost(t *testing.T) {
1023+
if os.Getenv("SKIP_NETWORK_TESTS") != "" {
1024+
t.Skip("skipping network-dependent test")
1025+
}
10141026
t.Parallel()
10151027

10161028
_, state, _ := util.TestMocks(t)
@@ -1052,6 +1064,9 @@ access(all) fun testSimple() {
10521064
}
10531065

10541066
func TestContractAddressForkResolution_UsesMainnetForkFirst(t *testing.T) {
1067+
if os.Getenv("SKIP_NETWORK_TESTS") != "" {
1068+
t.Skip("skipping network-dependent test")
1069+
}
10551070
t.Parallel()
10561071

10571072
_, state, _ := util.TestMocks(t)
@@ -1116,6 +1131,9 @@ access(all) fun testUsesMainnetForkAddress() {
11161131
}
11171132

11181133
func TestContractAddressForkResolution_FallbackToMainnet(t *testing.T) {
1134+
if os.Getenv("SKIP_NETWORK_TESTS") != "" {
1135+
t.Skip("skipping network-dependent test")
1136+
}
11191137
t.Parallel()
11201138

11211139
_, state, _ := util.TestMocks(t)
@@ -1180,6 +1198,9 @@ access(all) fun testFallbackToMainnetAddress() {
11801198
}
11811199

11821200
func TestContractAddressForkResolution_PrioritizesForkOverParent(t *testing.T) {
1201+
if os.Getenv("SKIP_NETWORK_TESTS") != "" {
1202+
t.Skip("skipping network-dependent test")
1203+
}
11831204
t.Parallel()
11841205

11851206
_, state, _ := util.TestMocks(t)

0 commit comments

Comments
 (0)