SSMStepDefinitions implements EC2StepFunctions { @When("^SSM \"([^\"]*)\" disk full with (\\d+) GB on (\\d+) instance$") public SSMStepDefinitions diskFullOnInstance(String volumeType, int size, int numHosts) throws Throwable { this.executeCommand(numHosts, Command.DISKFULL, volumeType, String.valueOf(size)); return this; } SSMStepDefinitions(); ExecutionStateCache getExecutionStateCache(); void setExecutionStateCache(ExecutionStateCache executionStateCache); @When("^executeCommand \"([^\"]*)\" on (\\d+) instance$") SSMStepDefinitions executeCommandOnHealthyInstances(String command, int numHosts); @Override void terminateProcessGivenInstance(String processName, String instanceID, String instanceIP); @When("^SSM terminate process \"([^\"]*)\" on (\\d+) instance$") SSMStepDefinitions terminateCommandOnHealthyInstances(String processName, int numHosts); @When("^assertCommand execution status = \"([^\"]*)\"$") void assertCommandExecutionStatus(final String expectedCommandStatus); @When("^SSM terminate process \"([^\"]*)\" on (\\d+) instance in zone \"([^\"]*)\"$") SSMStepDefinitions terminateProcessInAvailabilityZone(String processName, int numHosts, String zoneId); @Override void spikeCPUGivenInstance(int cores, String instanceID, String instanceIP); @When("^SSM CPU spike on (\\d+) instances for (\\d+) cores$") SSMStepDefinitions spikeCPUOnHealthyInstances(int numHosts, int cores); @When("^SSM terminate process \"([^\"]*)\"$") SSMStepDefinitions terminateProcessOnAllHealthyInstances(String processName); @Override void diskFullGivenInstance(String volumeType, int size, String instanceID, String instanceIP); @When("^SSM \"([^\"]*)\" disk full with (\\d+) GB on (\\d+) instance$") SSMStepDefinitions diskFullOnInstance(String volumeType, int size, int numHosts); @When("^SSM RAM disk full with (\\d+) GB on (\\d+) instance$") SSMStepDefinitions ramDiskFullOnInstance(int size, int numHosts); @When("^SSM block domain \"([^\"]*)\" on (\\d+) instances$") SSMStepDefinitions blockDomain(String domainName, int numHosts); @When("^SSM block DynamoDB on (\\d+) instances$") SSMStepDefinitions blockDynamoDB( int numHosts); @When("^SSM block S3 on (\\d+) instances$") SSMStepDefinitions blockS3(int numHosts); @When("^SSM stop (service|process) \"([^\"]*)\" on (\\d+) instance$") SSMStepDefinitions stopProcessOnHealthyInstances(String serviceOrProcessType, String processName, int numHosts); @When("^SSM start (service|process) \"([^\"]*)\" on (\\d+) instance$") SSMStepDefinitions startProcessOnHealthyInstances(String serviceOrProcessType, String processName, int numHosts); @When("^SSM corrupt network (\\d+) percent on (\\d+) instances$") SSMStepDefinitions corruptNetwork(int corruptPercent, int numHosts); @Override void injectNetworkLatencyGivenInstance(int lowerBound, int upperBound, String instanceID, String instanceIP); @When("^SSM inject network latency (\\d+) ms to (\\d+) ms on (\\d+) instances$") SSMStepDefinitions injectNetworkLatency(int lowerBound, int upperBound, int numHosts); @When("^SSM inject network packet loss (\\d+) percent on (\\d+) instances$") SSMStepDefinitions injectPacketLoss(int percentLoss, int numHosts); @Override void blockPortGivenInstance(int portNum, String instanceID, String instanceIP); @When("^SSM block network port (\\d+) on (\\d+) instances$") SSMStepDefinitions blockPort(int portNum, int numHosts); @When("^SSM block outbound network port (\\d+) on (\\d+) instances$") SSMStepDefinitions blockOutboundPort(int portNum, int numHosts);  }
@Test public void testDiskFullOnInstance() throws Exception { executionStateCache.setInstances(createInstances()); try { ssmStepDefinitions.diskFullOnInstance("root", 95, 1); } catch (Throwable t) { } Assert.assertEquals(executionStateCache.getCommandId(), "1234"); Assert.assertTrue(executionStateCache.getInstances().size()>0); Assert.assertTrue(executionStateCache.getSsmCommandInvocationInstances().size() > 0); }