Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(idt): remove cmd and bash requirements
Browse files Browse the repository at this point in the history
MikeDombo committed Mar 26, 2024
1 parent 45934c8 commit 23a5f85
Showing 4 changed files with 18 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -77,9 +77,9 @@ public class DeploymentSteps {
GreengrassDeploymentSpec deployment;


private Platform platform;
private Path artifactPath;
private Path recipePath;
private final Platform platform;
private final Path artifactPath;
private final Path recipePath;

@Inject
@SuppressWarnings("MissingJavadocMethod")
@@ -276,11 +276,12 @@ private String executeCommandWithConfigs(CommandInput commandInput) {
* @throws InterruptedException Task interrupted
*/
@When("I create a local deployment with components")
public void createLocalDeployment(List<List<String>> componentNames) throws InterruptedException {
public void createLocalDeployment(List<List<String>> componentNames) throws InterruptedException, IOException {
createLocalDeployment(componentNames, 0);
}

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

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

Files.createDirectories(artifactPath);
Files.createDirectories(recipePath);

for (Map.Entry<String, ComponentDeploymentSpecification> entry : components.entrySet()) {
commandArgs.add(" --merge ");
commandArgs.add(entry.getKey() + "=" + entry.getValue().componentVersion());
Original file line number Diff line number Diff line change
@@ -25,24 +25,18 @@
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;

import static com.aws.greengrass.testing.component.LocalComponentPreparationService.ARTIFACTS_DIR;
import static com.aws.greengrass.testing.component.LocalComponentPreparationService.LOCAL_STORE;
import static com.aws.greengrass.testing.component.LocalComponentPreparationService.RECIPE_DIR;

@ScenarioScoped
public class GreengrassCliSteps {

public static final String LOCAL_DEPLOYMENT_ID = "localDeploymentId";

private Platform platform;
private Path artifactPath;
private Path recipePath;
private TestContext testContext;
private ScenarioContext scenarioContext;
private ComponentPreparationService componentPreparation;
private WaitSteps waitSteps;
private final Platform platform;
private final TestContext testContext;
private final ScenarioContext scenarioContext;
private final ComponentPreparationService componentPreparation;
private final WaitSteps waitSteps;

private static Logger LOGGER = LogManager.getLogger(GreengrassCliSteps.class);
private static final Logger LOGGER = LogManager.getLogger(GreengrassCliSteps.class);

@Inject
@SuppressWarnings("MissingJavadocMethod")
@@ -54,8 +48,6 @@ public GreengrassCliSteps(Platform platform, TestContext testContext,
this.componentPreparation = componentPreparation;
this.scenarioContext = scenarioContext;
this.waitSteps = waitSteps;
this.artifactPath = testContext.testDirectory().resolve(LOCAL_STORE).resolve(ARTIFACTS_DIR);;
this.recipePath = testContext.testDirectory().resolve(LOCAL_STORE).resolve(RECIPE_DIR);
}

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

Original file line number Diff line number Diff line change
@@ -12,21 +12,11 @@ ComponentPublisher: Amazon
Manifests:
- Platform:
os: windows
Artifacts:
- URI: "file:C:/Windows/System32/cmd.exe"
Permission:
Read: ALL
Execute: ALL
Lifecycle:
run: |
cmd /c echo "Hello World!"
- Platform:
os: linux
Artifacts:
- URI: file:/bin/bash
Permission:
Read: ALL
Execute: ALL
Lifecycle:
run: |
bash -c "echo -ne \"Hello World!\n\""
echo "Hello World!"
Original file line number Diff line number Diff line change
@@ -12,21 +12,11 @@ ComponentPublisher: Amazon
Manifests:
- Platform:
os: windows
Artifacts:
- URI: "file:C:/Windows/System32/cmd.exe"
Permission:
Read: ALL
Execute: ALL
Lifecycle:
run: |
cmd /c echo "Hello World!"
- Platform:
os: linux
Artifacts:
- URI: file:/bin/bash
Permission:
Read: ALL
Execute: ALL
Lifecycle:
run: |
bash -c "echo -ne \"Hello World!\n\""
echo "Hello World!"

0 comments on commit 23a5f85

Please sign in to comment.