Skip to content

Commit 2f0a2ce

Browse files
committed
test(storage): refactor encryption tests to assert state over strings
1 parent bc1acc1 commit 2f0a2ce

1 file changed

Lines changed: 27 additions & 2 deletions

File tree

storage/system-test/buckets.test.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,17 @@ it('should set bucket encryption enforcement configuration', async () => {
7070
assert.match(output, new RegExp('Effective:'));
7171

7272
const [metadata] = await bucket.getMetadata();
73+
const encryption = metadata.encryption || {};
7374
assert.strictEqual(
74-
metadata.encryption.googleManagedEncryptionEnforcementConfig
75-
.restrictionMode,
75+
encryption.googleManagedEncryptionEnforcementConfig?.restrictionMode,
76+
'FullyRestricted'
77+
);
78+
assert.strictEqual(
79+
encryption.customerManagedEncryptionEnforcementConfig?.restrictionMode,
80+
'NotRestricted'
81+
);
82+
assert.strictEqual(
83+
encryption.customerSuppliedEncryptionEnforcementConfig?.restrictionMode,
7684
'FullyRestricted'
7785
);
7886
});
@@ -91,6 +99,23 @@ it('should get bucket encryption enforcement configuration', async () => {
9199
assert.include(output, 'Google Managed (GMEK) Enforcement:');
92100
assert.include(output, 'Mode: FullyRestricted');
93101
assert.match(output, /Effective:/);
102+
103+
const [metadata] = await bucket.getMetadata();
104+
const encryption = metadata.encryption || {};
105+
106+
assert.strictEqual(encryption.defaultKmsKeyName, defaultKmsKeyName);
107+
assert.strictEqual(
108+
encryption.googleManagedEncryptionEnforcementConfig?.restrictionMode,
109+
'FullyRestricted'
110+
);
111+
assert.strictEqual(
112+
encryption.customerManagedEncryptionEnforcementConfig?.restrictionMode,
113+
'NotRestricted'
114+
);
115+
assert.strictEqual(
116+
encryption.customerSuppliedEncryptionEnforcementConfig?.restrictionMode,
117+
'FullyRestricted'
118+
);
94119
});
95120

96121
it('should update and then remove bucket encryption enforcement configuration', async () => {

0 commit comments

Comments
 (0)