19
19
import static org .junit .Assert .assertEquals ;
20
20
import static org .junit .Assert .assertNotNull ;
21
21
import static org .junit .Assert .assertTrue ;
22
+ import static org .junit .Assume .assumeFalse ;
22
23
23
24
import com .example .storage .hmac .ActivateHmacKey ;
24
25
import com .example .storage .hmac .CreateHmacKey ;
33
34
import com .google .cloud .storage .HmacKey .HmacKeyState ;
34
35
import com .google .cloud .storage .ServiceAccount ;
35
36
import com .google .cloud .storage .Storage ;
36
- import com .google .cloud .testing .junit4 .MultipleAttemptsRule ;
37
37
import org .junit .Assert ;
38
38
import org .junit .Before ;
39
- import org .junit .Rule ;
40
39
import org .junit .Test ;
41
40
42
41
public class ITHmacSnippets extends TestBase {
@@ -46,11 +45,19 @@ public class ITHmacSnippets extends TestBase {
46
45
47
46
@ Before
48
47
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 ));
49
58
cleanUpHmacKeys (ServiceAccount .of (HMAC_KEY_TEST_SERVICE_ACCOUNT ));
50
59
}
51
60
52
- @ Rule public MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule (5 , 2000L );
53
-
54
61
private void cleanUpHmacKeys (ServiceAccount serviceAccount ) {
55
62
Page <HmacKey .HmacKeyMetadata > metadatas =
56
63
storage .listHmacKeys (Storage .ListHmacKeysOption .serviceAccount (serviceAccount ));
0 commit comments