Skip to content

Commit a3ce54e

Browse files
committed
test: skip hmac tests in CI
1 parent 1a8cbd5 commit a3ce54e

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

samples/snippets/src/test/java/com/example/storage/Env.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public final class Env {
2525
public static final String GOOGLE_CLOUD_PROJECT = System.getenv("GOOGLE_CLOUD_PROJECT");
2626
public static final String GOOGLE_CLOUD_PROJECT_NUMBER =
2727
System.getenv("GOOGLE_CLOUD_PROJECT_NUMBER");
28+
public static final String JOB_TYPE = System.getenv("JOB_TYPE");
2829

2930
private Env() {}
3031
}

samples/snippets/src/test/java/com/example/storage/ITHmacSnippets.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import static org.junit.Assert.assertEquals;
2020
import static org.junit.Assert.assertNotNull;
2121
import static org.junit.Assert.assertTrue;
22+
import static org.junit.Assume.assumeFalse;
2223

2324
import com.example.storage.hmac.ActivateHmacKey;
2425
import com.example.storage.hmac.CreateHmacKey;
@@ -33,10 +34,8 @@
3334
import com.google.cloud.storage.HmacKey.HmacKeyState;
3435
import com.google.cloud.storage.ServiceAccount;
3536
import com.google.cloud.storage.Storage;
36-
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
3737
import org.junit.Assert;
3838
import org.junit.Before;
39-
import org.junit.Rule;
4039
import org.junit.Test;
4140

4241
public class ITHmacSnippets extends TestBase {
@@ -46,11 +45,19 @@ public class ITHmacSnippets extends TestBase {
4645

4746
@Before
4847
public void before() {
48+
// Skip running Hmac snippet tests in CI
49+
// All of our samples CI uses a single service account. Each service account can only have 5
50+
// HMAC keys.
51+
// We have 6 test scenarios defined.
52+
// If more than one build is running at the same time they will fight with each other's limit
53+
// These samples have not materially changed since 2022-03 (as of 2025-05).
54+
// Additionally, we have more robust integration tests for HMAC operations in the library
55+
// itself.
56+
assumeFalse("skipping hmac snippet tests in CI due to racy interactions",
57+
"samples".equals(Env.JOB_TYPE));
4958
cleanUpHmacKeys(ServiceAccount.of(HMAC_KEY_TEST_SERVICE_ACCOUNT));
5059
}
5160

52-
@Rule public MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(5, 2000L);
53-
5461
private void cleanUpHmacKeys(ServiceAccount serviceAccount) {
5562
Page<HmacKey.HmacKeyMetadata> metadatas =
5663
storage.listHmacKeys(Storage.ListHmacKeysOption.serviceAccount(serviceAccount));

0 commit comments

Comments
 (0)