Skip to content
Open
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
22 changes: 22 additions & 0 deletions agent-job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: batch/v1
kind: Job
metadata:
name: agent
spec:
parallelism: 2
ttlSecondsAfterFinished: 0
template:
metadata:
labels:
app: agent
spec:
containers:
- name: agent-container
image: <TD docker image>
livenessProbe:
httpGet:
path: /health
port: 4567
initialDelaySeconds: 20
periodSeconds: 3
restartPolicy: Never
58 changes: 58 additions & 0 deletions driver_deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: driver
spec:
selector:
matchLabels:
app: driver
template:
metadata:
labels:
app: driver
spec:
containers:
- image: <driver-image>
name: driver-container
ports:
- containerPort: 4567
- containerPort: 80
livenessProbe:
httpGet:
path: /health
port: 4567
initialDelaySeconds: 20
periodSeconds: 3

---

apiVersion: v1
kind: Service
metadata:
name: driver
spec:
ports:
- port: 80
protocol: TCP
targetPort: 4567
name: http
selector:
app: driver

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: driver
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/force-ssl-redirect: "false"
spec:
rules:
- http:
paths:
- backend:
serviceName: driver
servicePort: 80
path: /config
6 changes: 6 additions & 0 deletions toughday/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -271,5 +271,11 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.7.2</version>
</dependency>

</dependencies>
</project>
27 changes: 19 additions & 8 deletions toughday/src/main/java/com/adobe/qe/toughday/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
*/
package com.adobe.qe.toughday;


import com.adobe.qe.toughday.internal.core.engine.Engine;
import com.adobe.qe.toughday.internal.core.config.parsers.cli.CliParser;
import com.adobe.qe.toughday.internal.core.config.Configuration;
import com.adobe.qe.toughday.internal.core.distributedtd.ExecutionTrigger;
import com.adobe.qe.toughday.internal.core.distributedtd.cluster.Agent;
import com.adobe.qe.toughday.internal.core.distributedtd.cluster.Driver;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;


/**
* Main class. Creates a Configuration and an engine and runs the tests.
*/
Expand All @@ -31,8 +32,6 @@ public class Main {
}

public static void main(String[] args) {


CliParser cliParser = new CliParser();
System.out.println();

Expand All @@ -51,15 +50,27 @@ public static void main(String[] args) {
System.exit(1);
}

Engine engine = new Engine(configuration);
engine.runTests();
/* check if we should trigger an execution query in the cluster. */
if (configuration.executeInDitributedMode()) {
new ExecutionTrigger(configuration).triggerDistributedExecution();
System.exit(0);
} else if (configuration.getDistributedConfig().getAgent()) {
Agent agent = new Agent();
agent.start();
} else if (configuration.getDistributedConfig().getDriver()) {
Driver driver = new Driver(configuration);
driver.run();
} else {
Engine engine = new Engine(configuration);
engine.runTests();

System.exit(0);
System.exit(0);
}
} catch (Throwable t) {
LOG.error("Error encountered: "
+ (t.getMessage() != null ? t.getMessage() : "Please check toughday.log for more information."));
LogManager.getLogger(Engine.class).error("Error encountered", t);
System.exit(-1);
}
System.exit(0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* Test suite class.
*/
public class TestSuite {
public class TestSuite implements Cloneable {
private List<SuiteSetup> setupStep;
private String description = "";
private List<String> tags = new ArrayList<>();
Expand All @@ -39,6 +39,24 @@ public TestSuite() {
totalWeight = 0;
}

/**
* Creates a copy of the current test suite. All tests contained by the test suite are cloned.
* @throws CloneNotSupportedException if the object to be cloned does not implement the Cloneable interface.
*/
public TestSuite clone() throws CloneNotSupportedException {
TestSuite newInstance = (TestSuite) super.clone();

/* clone all the tests in the TestSuite */
newInstance.orderedTests = new ArrayList<>();
newInstance.nameMap = new HashMap<>();

for (AbstractTest test : this.getTests()) {
newInstance.add(test.clone());
}

return newInstance;
}

/**
* Method for adding a test.
* @param test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class ConfigParams implements Serializable {

private List<PhaseParams> phasesParams = new ArrayList<>();
private Map<String, Object> globalParams = new HashMap<>();
private Map<String, Object> distributedConfigParams = new HashMap<>();
private Map<String, Object> publishModeParams = new HashMap<>();
private Map<String, Object> runModeParams = new HashMap<>();
private List<Map.Entry<Actions, MetaObject>> items = new ArrayList<>();
Expand Down Expand Up @@ -94,6 +95,10 @@ public void setGlobalParams(Map<String, Object> globalParams) {
this.globalParams = globalParams;
}

public void setDistributedConfigParams(Map<String, Object> distributedConfigParams) {
this.distributedConfigParams = distributedConfigParams;
}

public void setPhasesParams(List<PhaseParams> phasesParams) {
this.phasesParams = phasesParams;
}
Expand Down Expand Up @@ -163,12 +168,15 @@ public Map<String, Object> getGlobalParams(){
return globalParams;
}

public Map<String, Object> getDistributedConfigParams() { return distributedConfigParams; }

public Map<String, Object> getPublishModeParams() { return publishModeParams; }

public Map<String, Object> getRunModeParams() { return runModeParams; }

public void merge(ConfigParams other) {
globalParams.putAll(other.getGlobalParams());
distributedConfigParams.putAll(other.distributedConfigParams);
items.addAll(other.items);
phasesParams.addAll(other.phasesParams);

Expand Down
Loading