src/integration-test/java/GreengrassUpdateWithoutDockerIT.java
@Test
    public void shouldRemovePythonFunctionFromGroup() {
        // Create one group with a known name
        Optional<GreengrassGroupName> optionalGroupName = Optional.of(ImmutableGreengrassGroupName.builder().groupName(ioHelper.getUuid()).build());

        AwsGreengrassProvisioner.main(greengrassITShared.split(greengrassITShared.getPython3HelloWorldDeploymentCommand(optionalGroupName)));

        GreengrassGroupName groupName = optionalGroupName.get();

        // Get the information for the group so we can pull the Hello World function out of it
        GroupInformation groupInformation = v2GreengrassHelper.getGroupInformation(groupName).findFirst()
                .orElseThrow(() -> new RuntimeException("Group information not present"));

        // Pull the Hello World function out of the group
        Optional<Function> optionalGroupHelloWorldPythonFunction = getFunctionFromGroupInformation(groupInformation, HELLO_WORLD_PYTHON3);

        // Make sure the function is present
        Assert.assertTrue(optionalGroupHelloWorldPythonFunction.isPresent());

        // Get the function information, extract the short name, and create a new alias
        Function helloWorldPythonFunction = optionalGroupHelloWorldPythonFunction.get();
        FunctionName helloWorldPythonFunctionName = extractFunctionName(helloWorldPythonFunction);
        FunctionAlias helloWorldPythonFunctionAlias = extractFunctionAlias(helloWorldPythonFunction);

        // Remove the function from the group
        AwsGreengrassProvisioner.main(greengrassITShared.split(greengrassITShared.getRemoveFunctionCommand(groupName, helloWorldPythonFunctionName, helloWorldPythonFunctionAlias)));

        // Make sure the function is not present in the group after the update
        GroupInformation groupInformationAfterUpdate = v2GreengrassHelper.getGroupInformation(groupName).findFirst()
                .orElseThrow(() -> new RuntimeException("Group information not present after update"));

        Optional<Function> optionalGroupHelloWorldPythonFunctionAfterUpdate = getFunctionFromGroupInformation(groupInformationAfterUpdate, HELLO_WORLD_PYTHON3);

        Assert.assertFalse(optionalGroupHelloWorldPythonFunctionAfterUpdate.isPresent());
    }
// Test set 2: Build a group with Python 2 Hello World, remove the Python 2 Hello World function
Test set 2: Build a group with Python 2 Hello World, remove the Python 2 Hello World function
Test set 2 : Build a group with Python 2 Hello World remove the Python 2 Hello World function
@Test
    public void shouldRemovePythonFunctionFromGroup() {
        Optional<GreengrassGroupName> optionalGroupName = Optional.of(ImmutableGreengrassGroupName.builder().groupName(ioHelper.getUuid()).build());
        AwsGreengrassProvisioner.main(greengrassITShared.split(greengrassITShared.getPython3HelloWorldDeploymentCommand(optionalGroupName)));
        GreengrassGroupName groupName = optionalGroupName.get();
        GroupInformation groupInformation = v2GreengrassHelper.getGroupInformation(groupName).findFirst()
                .orElseThrow(() -> new RuntimeException("Group information not present"));
        Optional<Function> optionalGroupHelloWorldPythonFunction = getFunctionFromGroupInformation(groupInformation, HELLO_WORLD_PYTHON3);
        Assert.assertTrue(optionalGroupHelloWorldPythonFunction.isPresent());
        Function helloWorldPythonFunction = optionalGroupHelloWorldPythonFunction.get();
        FunctionName helloWorldPythonFunctionName = extractFunctionName(helloWorldPythonFunction);
        FunctionAlias helloWorldPythonFunctionAlias = extractFunctionAlias(helloWorldPythonFunction);
        AwsGreengrassProvisioner.main(greengrassITShared.split(greengrassITShared.getRemoveFunctionCommand(groupName, helloWorldPythonFunctionName, helloWorldPythonFunctionAlias)));
        GroupInformation groupInformationAfterUpdate = v2GreengrassHelper.getGroupInformation(groupName).findFirst()
                .orElseThrow(() -> new RuntimeException("Group information not present after update"));
        Optional<Function> optionalGroupHelloWorldPythonFunctionAfterUpdate = getFunctionFromGroupInformation(groupInformationAfterUpdate, HELLO_WORLD_PYTHON3);
        Assert.assertFalse(optionalGroupHelloWorldPythonFunctionAfterUpdate.isPresent());
    }
@ Test public void shouldRemovePythonFunctionFromGroup ( ) { Optional < GreengrassGroupName > optionalGroupName = Optional . of ( ImmutableGreengrassGroupName . builder ( ) . groupName ( ioHelper . getUuid ( ) ) . build ( ) ) ; AwsGreengrassProvisioner . main ( greengrassITShared . split ( greengrassITShared . getPython3HelloWorldDeploymentCommand ( optionalGroupName ) ) ) ; GreengrassGroupName groupName = optionalGroupName . get ( ) ; GroupInformation groupInformation = v2GreengrassHelper . getGroupInformation ( groupName ) . findFirst ( ) . orElseThrow ( ( ) -> new RuntimeException ( "Group information not present" ) ) ; Optional < Function > optionalGroupHelloWorldPythonFunction = getFunctionFromGroupInformation ( groupInformation , HELLO_WORLD_PYTHON3 ) ; Assert . assertTrue ( optionalGroupHelloWorldPythonFunction . isPresent ( ) ) ; Function helloWorldPythonFunction = optionalGroupHelloWorldPythonFunction . get ( ) ; FunctionName helloWorldPythonFunctionName = extractFunctionName ( helloWorldPythonFunction ) ; FunctionAlias helloWorldPythonFunctionAlias = extractFunctionAlias ( helloWorldPythonFunction ) ; AwsGreengrassProvisioner . main ( greengrassITShared . split ( greengrassITShared . getRemoveFunctionCommand ( groupName , helloWorldPythonFunctionName , helloWorldPythonFunctionAlias ) ) ) ; GroupInformation groupInformationAfterUpdate = v2GreengrassHelper . getGroupInformation ( groupName ) . findFirst ( ) . orElseThrow ( ( ) -> new RuntimeException ( "Group information not present after update" ) ) ; Optional < Function > optionalGroupHelloWorldPythonFunctionAfterUpdate = getFunctionFromGroupInformation ( groupInformationAfterUpdate , HELLO_WORLD_PYTHON3 ) ; Assert . assertFalse ( optionalGroupHelloWorldPythonFunctionAfterUpdate . isPresent ( ) ) ; }
Test set 2: Build a group with Python 2 Hello World, remove the Python 2 Hello World function
Test set 2 : Build a group with Python 2 Hello World remove the Python 2 Hello World function
// Create one group with a known name // Get the information for the group so we can pull the Hello World function out of it // Pull the Hello World function out of the group // Make sure the function is present // Get the function information, extract the short name, and create a new alias // Remove the function from the group // Make sure the function is not present in the group after the update