Skip to content

Commit

Permalink
Make tests less likely to fail due to resources not having been delet…
Browse files Browse the repository at this point in the history
…ed (yet)
  • Loading branch information
cartwrightian committed Mar 8, 2022
1 parent 5eae480 commit ecbda4a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/cfnScripts/subnetWithS3Param.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"AvailabilityZone":{
"Ref":"zoneA"
},
"CidrBlock":"10.0.10.0/24",
"CidrBlock":"10.0.43.0/24",
"Tags":[
{
"Key":"Name",
Expand Down
5 changes: 3 additions & 2 deletions test/tw/com/acceptance/TestCommandLineS3Operations.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public void beforeEveryTestRun() {
deletesStacks.ifPresent(EnvironmentSetupForTests.TEMPORARY_STACK)
.ifPresent("CfnAssistTest01createSubnet")
.ifPresent("CfnAssistTest02createAcls")
.ifPresent("CfnAssistTestsimpleStack");
.ifPresent("CfnAssistTestsimpleStack")
.ifPresent("CfnAssist9987TestsubnetWithS3Param");
deletesStacks.act();
testName = test.getMethodName();
}
Expand All @@ -72,7 +73,7 @@ private void deleteTestKeysFromBucket() {
s3Client.deleteObject(DeleteObjectRequest.builder().bucket(EnvironmentSetupForTests.BUCKET_NAME).key(KEY_B).build());
}
catch(S3Exception exception) {
System.out.println(exception);
System.out.println(exception.toString());
}
}

Expand Down
8 changes: 5 additions & 3 deletions test/tw/com/acceptance/TestCommandLineStackOperations.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.io.IOException;
import java.io.PrintStream;
import java.nio.charset.Charset;
import java.util.concurrent.TimeUnit;

import static org.junit.Assert.assertEquals;

Expand All @@ -44,20 +45,21 @@ public static void beforeAllTestsRun() {
String testName = "";

@Rule
public Timeout globalTimeout = new Timeout(5*60*1000);
public Timeout globalTimeout = new Timeout(5*60, TimeUnit.SECONDS);

@Before
public void beforeEveryTestRun() {
vpcRepository = new VpcRepository(new CloudClient(ec2Client, new DefaultAwsRegionProviderChain()));
altProjectAndEnv = EnvironmentSetupForTests.getAltProjectAndEnv();
EnvironmentSetupForTests.getMainProjectAndEnv();
// EnvironmentSetupForTests.getMainProjectAndEnv();

altEnvVPC = EnvironmentSetupForTests.findAltVpc(vpcRepository);
deletesStacks = new DeletesStacks(cfnClient);
deletesStacks.ifPresent(EnvironmentSetupForTests.TEMPORARY_STACK)
.ifPresent("CfnAssistTest01createSubnet")
.ifPresent("CfnAssistTest02createAcls")
.ifPresent("CfnAssistTestsimpleStack")
.ifPresent("CfnAssistTestsubnetWithParam")
.ifPresent("CfnAssistTestsubnet")
.ifPresent("CfnAssist876TestelbAndInstance")
.ifPresent("CfnAssistTestsimpleStackWithAZ");
Expand Down Expand Up @@ -108,7 +110,7 @@ public void testListStacks() {

System.setOut(origStream);

String outputText = new String(stream.toByteArray(), Charset.defaultCharset());
String outputText = stream.toString(Charset.defaultCharset());
CLIArgBuilder.checkForExpectedLine(outputText, "CfnAssistTestsimpleStack", "CfnAssist", "Test", StackStatus.CREATE_COMPLETE.toString());

deletesStacks.ifPresent("CfnAssistTestsimpleStack");
Expand Down

0 comments on commit ecbda4a

Please sign in to comment.