Skip to content

Commit a301b56

Browse files
committed
fix(idt): remove cmd and bash requirements
1 parent 45934c8 commit a301b56

File tree

4 files changed

+18
-41
lines changed

4 files changed

+18
-41
lines changed

aws-greengrass-testing-features/aws-greengrass-testing-features-api/src/main/java/com/aws/greengrass/testing/features/DeploymentSteps.java

+9-4
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ public class DeploymentSteps {
7878

7979

8080
private Platform platform;
81-
private Path artifactPath;
82-
private Path recipePath;
81+
private final Path artifactPath;
82+
private final Path recipePath;
8383

8484
@Inject
8585
@SuppressWarnings("MissingJavadocMethod")
@@ -274,13 +274,15 @@ private String executeCommandWithConfigs(CommandInput commandInput) {
274274
* Create a local deployment using greengrass cli.
275275
* @param componentNames map of component name to source of the component
276276
* @throws InterruptedException Task interrupted
277+
* @throws IOException if required directories cannot be made
277278
*/
278279
@When("I create a local deployment with components")
279-
public void createLocalDeployment(List<List<String>> componentNames) throws InterruptedException {
280+
public void createLocalDeployment(List<List<String>> componentNames) throws InterruptedException, IOException {
280281
createLocalDeployment(componentNames, 0);
281282
}
282283

283-
private void createLocalDeployment(List<List<String>> componentNames, int retryCount) throws InterruptedException {
284+
private void createLocalDeployment(List<List<String>> componentNames, int retryCount)
285+
throws InterruptedException, IOException {
284286
// find the component artifacts and copy into a local store
285287
final Map<String, ComponentDeploymentSpecification> components = parseComponentNamesAndPrepare(componentNames);
286288

@@ -291,6 +293,9 @@ private void createLocalDeployment(List<List<String>> componentNames, int retryC
291293
"--artifactDir " + artifactPath.toString(),
292294
"--recipeDir " + recipePath.toString()));
293295

296+
Files.createDirectories(artifactPath);
297+
Files.createDirectories(recipePath);
298+
294299
for (Map.Entry<String, ComponentDeploymentSpecification> entry : components.entrySet()) {
295300
commandArgs.add(" --merge ");
296301
commandArgs.add(entry.getKey() + "=" + entry.getValue().componentVersion());

aws-greengrass-testing-features/aws-greengrass-testing-features-api/src/main/java/com/aws/greengrass/testing/features/GreengrassCliSteps.java

+7-15
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,18 @@
2525
import java.util.concurrent.TimeUnit;
2626
import javax.inject.Inject;
2727

28-
import static com.aws.greengrass.testing.component.LocalComponentPreparationService.ARTIFACTS_DIR;
29-
import static com.aws.greengrass.testing.component.LocalComponentPreparationService.LOCAL_STORE;
30-
import static com.aws.greengrass.testing.component.LocalComponentPreparationService.RECIPE_DIR;
31-
3228
@ScenarioScoped
3329
public class GreengrassCliSteps {
3430

3531
public static final String LOCAL_DEPLOYMENT_ID = "localDeploymentId";
3632

37-
private Platform platform;
38-
private Path artifactPath;
39-
private Path recipePath;
40-
private TestContext testContext;
41-
private ScenarioContext scenarioContext;
42-
private ComponentPreparationService componentPreparation;
43-
private WaitSteps waitSteps;
33+
private final Platform platform;
34+
private final TestContext testContext;
35+
private final ScenarioContext scenarioContext;
36+
private final ComponentPreparationService componentPreparation;
37+
private final WaitSteps waitSteps;
4438

45-
private static Logger LOGGER = LogManager.getLogger(GreengrassCliSteps.class);
39+
private static final Logger LOGGER = LogManager.getLogger(GreengrassCliSteps.class);
4640

4741
@Inject
4842
@SuppressWarnings("MissingJavadocMethod")
@@ -54,8 +48,6 @@ public GreengrassCliSteps(Platform platform, TestContext testContext,
5448
this.componentPreparation = componentPreparation;
5549
this.scenarioContext = scenarioContext;
5650
this.waitSteps = waitSteps;
57-
this.artifactPath = testContext.testDirectory().resolve(LOCAL_STORE).resolve(ARTIFACTS_DIR);;
58-
this.recipePath = testContext.testDirectory().resolve(LOCAL_STORE).resolve(RECIPE_DIR);
5951
}
6052

6153
/**
@@ -99,7 +91,7 @@ public void verifyLocalDeployment(String status, int value, String unit) throws
9991
terminalStatuses.add("SUCCEEDED");
10092
terminalStatuses.add("FAILED");
10193
TimeUnit timeUnit = TimeUnit.valueOf(unit.toUpperCase());
102-
waitSteps.untilTerminal(() -> this.getLocalDeploymentStatus(), status::equals,
94+
waitSteps.untilTerminal(this::getLocalDeploymentStatus, status::equals,
10395
terminalStatuses::contains, value, timeUnit);
10496
}
10597

aws-greengrass-testing-features/aws-greengrass-testing-features-cloudcomponent/src/main/resources/greengrass/components/recipes/hello_world_recipe_multiplatform.yaml

+1-11
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,11 @@ ComponentPublisher: Amazon
1212
Manifests:
1313
- Platform:
1414
os: windows
15-
Artifacts:
16-
- URI: "file:C:/Windows/System32/cmd.exe"
17-
Permission:
18-
Read: ALL
19-
Execute: ALL
2015
Lifecycle:
2116
run: |
2217
cmd /c echo "Hello World!"
2318
- Platform:
2419
os: linux
25-
Artifacts:
26-
- URI: file:/bin/bash
27-
Permission:
28-
Read: ALL
29-
Execute: ALL
3020
Lifecycle:
3121
run: |
32-
bash -c "echo -ne \"Hello World!\n\""
22+
echo "Hello World!"

aws-greengrass-testing-features/aws-greengrass-testing-features-localdeployment/src/main/resources/greengrass/components/recipes/local_hello_world_multiplatform.yaml

+1-11
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,11 @@ ComponentPublisher: Amazon
1212
Manifests:
1313
- Platform:
1414
os: windows
15-
Artifacts:
16-
- URI: "file:C:/Windows/System32/cmd.exe"
17-
Permission:
18-
Read: ALL
19-
Execute: ALL
2015
Lifecycle:
2116
run: |
2217
cmd /c echo "Hello World!"
2318
- Platform:
2419
os: linux
25-
Artifacts:
26-
- URI: file:/bin/bash
27-
Permission:
28-
Read: ALL
29-
Execute: ALL
3020
Lifecycle:
3121
run: |
32-
bash -c "echo -ne \"Hello World!\n\""
22+
echo "Hello World!"

0 commit comments

Comments
 (0)