1919import static org .junit .Assert .assertEquals ;
2020import static org .junit .Assert .assertNotNull ;
2121import static org .junit .Assert .assertTrue ;
22+ import static org .junit .Assume .assumeFalse ;
2223
2324import com .example .storage .hmac .ActivateHmacKey ;
2425import com .example .storage .hmac .CreateHmacKey ;
3334import com .google .cloud .storage .HmacKey .HmacKeyState ;
3435import com .google .cloud .storage .ServiceAccount ;
3536import com .google .cloud .storage .Storage ;
36- import com .google .cloud .testing .junit4 .MultipleAttemptsRule ;
3737import org .junit .Assert ;
3838import org .junit .Before ;
39- import org .junit .Rule ;
4039import org .junit .Test ;
4140
4241public 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