这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Mar 4, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Thumbs.db
*/bin
/test-output
*/test-output
/classes

# IntelliJ specific files/directories
out
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ test {
useTestNG()
}

tasks.withType(Compile) {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint" << "-Werror"
}

Expand Down
26 changes: 13 additions & 13 deletions gradle/convention.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,28 +58,28 @@ status = project.hasProperty('preferredStatus')?project.preferredStatus:(version
test.runtimeClasspath += project.configurations.provided
}

apply plugin: 'github-pages' // Used to create publishGhPages task
// apply plugin: 'github-pages' // Used to create publishGhPages task

def docTasks = [:]
[Javadoc,ScalaDoc,Groovydoc].each{ Class docClass ->
tasks.withType(docClass).each { docTask ->
docTasks[docTask.name] = docTask
processGhPages.dependsOn(docTask)
// processGhPages.dependsOn(docTask)
}
}

githubPages {
repoUri = "git@github.com:Netflix/${rootProject.githubProjectName}.git"
pages {
docTasks.each { shortName, docTask ->
from(docTask.outputs.files) {
into "docs/${shortName}"
}
}
}
}
// githubPages {
// repoUri = "git@github.com:Netflix/${rootProject.githubProjectName}.git"
// pages {
// docTasks.each { shortName, docTask ->
// from(docTask.outputs.files) {
// into "docs/${shortName}"
// }
// }
// }
// }

// Generate wrapper, which is distributed as part of source to alleviate the need of installing gradle
task createWrapper(type: Wrapper) {
gradleVersion = '1.12'
gradleVersion = '2.2.1'
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-bin.zip
distributionUrl=http\://services.gradle.org/distributions/gradle-2.2.1-bin.zip
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ private static String getTagValue(String key, List<Tag> tags) {
*/
private static boolean needsUpdate(Map<String, String> metadata,
String owner, String instance, Date lastDetachTime) {
return (owner != null && !StringUtils.equals(metadata.get(JanitorMonkey.OWNER_TAG_KEY), owner))
|| (instance != null && !StringUtils.equals(metadata.get(JanitorMonkey.INSTANCE_TAG_KEY), instance))
return owner != null && !StringUtils.equals(metadata.get(JanitorMonkey.OWNER_TAG_KEY), owner)
|| instance != null && !StringUtils.equals(metadata.get(JanitorMonkey.INSTANCE_TAG_KEY), instance)
|| lastDetachTime != null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void start(Monkey monkey, Runnable command) {
// we have events, so set the start time to the time left in what would have been the last cycle
Date eventTime = events.get(0).eventTime();
Date now = new Date();
long init = cycle - (now.getTime() - eventTime.getTime());
long init = cycle - now.getTime() + eventTime.getTime();
LOGGER.info("Detected previous events within cycle, setting " + monkey.type().name() + " start to "
+ new Date(now.getTime() + init));
futures.put(monkey.type().name(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public class BurnCpuChaosType extends ScriptChaosType {
*
* @param config
* Configuration to use
* @throws IOException
*/
public BurnCpuChaosType(MonkeyConfiguration config) {
super(config, "BurnCpu");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public class BurnIoChaosType extends ScriptChaosType {
*
* @param config
* Configuration to use
* @throws IOException
*/
public BurnIoChaosType(MonkeyConfiguration config) {
super(config, "BurnIO");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/netflix/simianarmy/chaos/ChaosType.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,6 @@ protected boolean isRootVolumeEbs(ChaosInstance instance) {
List<String> withRoot = cloudClient.listAttachedVolumes(instanceId, true);
List<String> withoutRoot = cloudClient.listAttachedVolumes(instanceId, false);

return (withRoot.size() != withoutRoot.size());
return withRoot.size() != withoutRoot.size();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@
import com.netflix.simianarmy.MonkeyConfiguration;

/**
* Blocks TCP & UDP port 53, so DNS resolution fails.
* Blocks TCP &amp; UDP port 53, so DNS resolution fails.
*/
public class FailDnsChaosType extends ScriptChaosType {
/**
* Constructor.
*
* @param config
* Configuration to use
* @throws IOException
*/
public FailDnsChaosType(MonkeyConfiguration config) {
super(config, "FailDns");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class FailDynamoDbChaosType extends ScriptChaosType {
*
* @param config
* Configuration to use
* @throws IOException
*/
public FailDynamoDbChaosType(MonkeyConfiguration config) {
super(config, "FailDynamoDb");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class FailEc2ChaosType extends ScriptChaosType {
*
* @param config
* Configuration to use
* @throws IOException
*/
public FailEc2ChaosType(MonkeyConfiguration config) {
super(config, "FailEc2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class FailS3ChaosType extends ScriptChaosType {
*
* @param config
* Configuration to use
* @throws IOException
*/
public FailS3ChaosType(MonkeyConfiguration config) {
super(config, "FailS3");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public class FillDiskChaosType extends ScriptChaosType {
*
* @param config
* Configuration to use
* @throws IOException
*/
public FillDiskChaosType(MonkeyConfiguration config) {
super(config, "FillDisk");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public class KillProcessesChaosType extends ScriptChaosType {
*
* @param config
* Configuration to use
* @throws IOException
*/
public KillProcessesChaosType(MonkeyConfiguration config) {
super(config, "KillProcesses");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class NetworkCorruptionChaosType extends ScriptChaosType {
*
* @param config
* Configuration to use
* @throws IOException
*/
public NetworkCorruptionChaosType(MonkeyConfiguration config) {
super(config, "NetworkCorruption");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class NetworkLatencyChaosType extends ScriptChaosType {
*
* @param config
* Configuration to use
* @throws IOException
*/
public NetworkLatencyChaosType(MonkeyConfiguration config) {
super(config, "NetworkLatency");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class NetworkLossChaosType extends ScriptChaosType {
*
* @param config
* Configuration to use
* @throws IOException
*/
public NetworkLossChaosType(MonkeyConfiguration config) {
super(config, "NetworkLoss");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public class NullRouteChaosType extends ScriptChaosType {
*
* @param config
* Configuration to use
* @throws IOException
*/
public NullRouteChaosType(MonkeyConfiguration config) {
super(config, "NullRoute");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public abstract class ScriptChaosType extends ChaosType {
* Configuration to use
* @param key
* Key for the chaos money
* @throws IOException
*/
public ScriptChaosType(MonkeyConfiguration config, String key) {
super(config, key);
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/netflix/simianarmy/chaos/SshConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public class SshConfig {
*
* @param config
* Configuration to use
* @throws IOException
*/
public SshConfig(MonkeyConfiguration config) {
String sshUser = config.getStrOrElse("simianarmy.chaos.ssh.user", "root");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public List<LoadBalancerDescription> describeElasticLoadBalancers(String... name
/**
* Describe a set of specific ELBs.
*
* @param names the ELB names
* @param name the ELB name
* @return the ELBs
*/
public LoadBalancerAttributes describeElasticLoadBalancerAttributes(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import com.amazonaws.services.autoscaling.model.AutoScalingGroup;
import com.amazonaws.services.autoscaling.model.Instance;

import com.netflix.simianarmy.GroupType;
import com.netflix.simianarmy.basic.chaos.BasicInstanceGroup;
import com.netflix.simianarmy.chaos.ChaosCrawler;
Expand All @@ -38,45 +39,55 @@ public class ASGChaosCrawler implements ChaosCrawler {
*/
public enum Types implements GroupType {

/** only crawls AutoScalingGroups. */
/**
* only crawls AutoScalingGroups.
*/
ASG;
}

/** The aws client. */
/**
* The aws client.
*/
private final AWSClient awsClient;

/**
* Instantiates a new basic chaos crawler.
*
* @param awsClient
* the aws client
* @param awsClient the aws client
*/
public ASGChaosCrawler(AWSClient awsClient) {
public ASGChaosCrawler(final AWSClient awsClient) {
this.awsClient = awsClient;
}

/** {@inheritDoc} */
/**
* {@inheritDoc}
*/
@Override
public EnumSet<?> groupTypes() {
@SuppressWarnings("rawtypes")
public EnumSet groupTypes() {
return EnumSet.allOf(Types.class);
}

/** {@inheritDoc} */
/**
* {@inheritDoc}
*/
@Override
public List<InstanceGroup> groups() {
return groups((String[]) null);
}

@Override
public List<InstanceGroup> groups(String... names) {
public List<InstanceGroup> groups(final String... names) {
List<InstanceGroup> list = new LinkedList<InstanceGroup>();
for (AutoScalingGroup asg : awsClient.describeAutoScalingGroups(names)) {
InstanceGroup ig = new BasicInstanceGroup(asg.getAutoScalingGroupName(), Types.ASG, awsClient.region());
for (Instance inst : asg.getInstances()) {
ig.addInstance(inst.getInstanceId());
}

list.add(ig);
}

return list;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void testDelayedStart() throws Exception {
task = new FutureTask<Void>(Callables.<Void>returning(null));
sched.start(mockMonkey, task);
try {
task.get(100, TimeUnit.MILLISECONDS);
task.get(100L, TimeUnit.MILLISECONDS);
Assert.fail("The task shouldn't have been completed in 100ms");
} catch (TimeoutException e) { // NOPMD - This is an expected exception
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ public void testEvenSelections(double probability) {

// allow for 4% variation over all the selection runs
int avg = Double.valueOf((RUNS / (double) group.instances().size()) * probability).intValue();
int max = Double.valueOf(avg + (avg * 0.04)).intValue();
int min = Double.valueOf(avg - (avg * 0.04)).intValue();
int max = Double.valueOf(avg + avg * 0.04).intValue();
int min = Double.valueOf(avg - avg * 0.04).intValue();

for (Map.Entry<String, Integer> pair : selectMap.entrySet()) {
Assert.assertTrue(pair.getValue() > min && pair.getValue() < max, pair.getKey() + " selected " + avg
Expand Down
Loading