use of com.amazonaws.services.lambda.model.AliasConfiguration in project pipeline-aws-plugin by jenkinsci.
the class LambdaVersionCleanupStepTest method ignoreAliases.
@Test
public void ignoreAliases() throws Exception {
WorkflowJob job = this.jenkinsRule.jenkins.createProject(WorkflowJob.class, "cfnTest");
Mockito.when(this.awsLambda.listAliases(Mockito.eq(new ListAliasesRequest().withFunctionName("foo")))).thenReturn(new ListAliasesResult().withAliases(new AliasConfiguration().withFunctionVersion("myVersion")));
Mockito.when(this.awsLambda.listVersionsByFunction(Mockito.eq(new ListVersionsByFunctionRequest().withFunctionName("foo")))).thenReturn(new ListVersionsByFunctionResult().withVersions(Arrays.asList(new FunctionConfiguration().withVersion("myVersion").withLastModified(ZonedDateTime.now().minusDays(15).format(DateTimeFormatter.ISO_ZONED_DATE_TIME)))));
job.setDefinition(new CpsFlowDefinition("" + "node {\n" + " lambdaVersionCleanup(functionName: 'foo', daysAgo: 5)\n" + "}\n", true));
this.jenkinsRule.assertBuildStatusSuccess(job.scheduleBuild2(0));
Mockito.verify(this.awsLambda).listVersionsByFunction(Mockito.any());
Mockito.verify(this.awsLambda).listAliases(Mockito.any());
Mockito.verifyNoMoreInteractions(this.awsLambda);
}
Aggregations