Skip to content

Commit ea1d197

Browse files
committed
Testing latest SM version
1 parent 5d4487e commit ea1d197

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

secretmanager/src/test/java/secretmanager/SnippetsIT.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
import com.google.cloud.resourcemanager.v3.CreateTagKeyRequest;
2424
import com.google.cloud.resourcemanager.v3.CreateTagValueMetadata;
2525
import com.google.cloud.resourcemanager.v3.CreateTagValueRequest;
26+
import com.google.cloud.resourcemanager.v3.DeleteTagKeyMetadata;
27+
import com.google.cloud.resourcemanager.v3.DeleteTagKeyRequest;
28+
import com.google.cloud.resourcemanager.v3.DeleteTagValueRequest;
29+
import com.google.cloud.resourcemanager.v3.DeleteTagValueMetadata;
2630
import com.google.api.gax.longrunning.OperationFuture;
2731
import com.google.cloud.resourcemanager.v3.TagKey;
2832
import com.google.cloud.resourcemanager.v3.TagKeysClient;
@@ -203,6 +207,28 @@ private static void createTags() throws IOException{
203207
}
204208

205209
private static void deleteTags() throws IOException{
210+
try (TagValuesClient tagValuesClient = TagValuesClient.create()) {
211+
DeleteTagValueRequest request =
212+
DeleteTagValueRequest.newBuilder()
213+
.setName(TAG_VALUE.getName())
214+
.build();
215+
OperationFuture<TagValue, DeleteTagValueMetadata> future =
216+
tagValuesClient.deleteTagValueOperationCallable().futureCall(request);
217+
TagValue response = future.get();
218+
}catch(Exception e){
219+
}
220+
221+
try (TagKeysClient tagKeysClient = TagKeysClient.create()) {
222+
DeleteTagKeyRequest request =
223+
DeleteTagKeyRequest.newBuilder()
224+
.setName(TAG_KEY.getName())
225+
.build();
226+
OperationFuture<TagKey, DeleteTagKeyMetadata> future =
227+
tagKeysClient.deleteTagKeyOperationCallable().futureCall(request);
228+
TagKey response = future.get();
229+
}catch(Exception e){
230+
}
231+
206232
}
207233

208234
private static Secret createSecret(boolean addAnnotation) throws IOException {

secretmanager/src/test/java/secretmanager/regionalsamples/SnippetsIT.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,12 @@ public void testCreateRegionalSecretWithLabel() throws IOException {
305305
public void testCreateRegionalSecretWithTags() throws IOException {
306306
SecretName name = TEST_REGIONAL_SECRET_WITH_TAGS_TO_CREATE_NAME;
307307
Secret secret = CreateRegionalSecretWithTags.createRegionalSecretWithTags(
308-
name.getProject(), name.getLocation(), name.getSecret(), TAG_KEY, TAG_VALUE);
308+
name.getProject(),
309+
name.getLocation(),
310+
name.getSecret(),
311+
TAG_KEY.getName(),
312+
TAG_VALUE.getName()
313+
);
309314

310315
assertThat(stdOut.toString()).contains("Created secret with Tags");
311316
}

0 commit comments

Comments
 (0)