Skip to content

Commit da11e62

Browse files
Skip dataset test when secret key is not available
1 parent 8462069 commit da11e62

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/test/java/co/ipregistry/datasets/IpregistryGeolocationDatasetTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import co.ipregistry.datasets.model.GeolocationData;
44
import org.junit.jupiter.api.Assertions;
5+
import org.junit.jupiter.api.Assumptions;
56
import org.junit.jupiter.api.Test;
67

78
import java.io.IOException;
@@ -13,9 +14,12 @@ public class IpregistryGeolocationDatasetTest {
1314

1415
@Test
1516
public void test() throws IOException {
17+
String secretKey = System.getenv("IPREGISTRY_DATASETS_SECRET_KEY");
18+
Assumptions.assumeTrue(secretKey != null && !secretKey.isEmpty(),
19+
"IPREGISTRY_DATASETS_SECRET_KEY environment variable not set");
20+
1621
try (IpregistryGeolocationDataset dataset =
17-
IpregistryGeolocationDataset.builder(
18-
System.getenv("IPREGISTRY_DATASETS_SECRET_KEY")).build()) {
22+
IpregistryGeolocationDataset.builder(secretKey).build()) {
1923

2024
Assertions.assertTrue(
2125
dataset.getBuildDate().isAfter(

0 commit comments

Comments
 (0)