Skip to content

Commit

Permalink
feat: Workflow tests - junit reports (#5881)
Browse files Browse the repository at this point in the history
* status page examples, curl workflows updated

* cypress test updated - junit

* playwright and postman - junit examples

* workflow tests - pytest project

* workflow tests - pytest project - test files renamed

* workflow tests - pytest - pytest.ini

* workflow tests - pytest - pytest.ini updated

* workflow tests - junit5

* workflow tests - junit5 tests - pom updated

* workflow tests - junit5 tests - filenames updated

* workflow tests - junit5

* workflow tests - junit5 tests added

* workflow tests - junit5 pom updated

* workflow tests - junit5 pom updated

* workflow tests - junit5 pom updated

* workflow tests - junit5 pom updated

* workflow tests - junit5

* workflow tests - junit5

* workflow tests - junit5

* workflow tests - junit5

* workflow tests - junit5

* workflow tests - junit5

* junit 5 project - pom fixed

* junit 5 - pom updated (junit report)

* junit 5 - pom updated (junit report)

* junit 5 - tests updated

* junit 5 - tests extended

* workflow tests - suites updated

* workflow tests - pytest

* workflow tests - suites extended, run scirpt

* junit target removed
  • Loading branch information
tkonieczny authored Sep 30, 2024
1 parent 542c5e1 commit 65f6c2a
Show file tree
Hide file tree
Showing 26 changed files with 663 additions and 37 deletions.
6 changes: 3 additions & 3 deletions test/curl/executor-tests/crd-workflow/smoke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
memory: 32Mi
steps:
- name: Run tests
shell: curl https://testkube.io
shell: curl -f -LI https://testkube.io
container:
image: curlimages/curl:8.7.1
---
Expand All @@ -33,7 +33,7 @@ spec:
memory: 32Mi
steps:
- name: Run tests
shell: curl https://testkube.io && sleep 10
shell: curl -f -LI https://testkube.io && sleep 10
container:
image: tkoniecznykubeshop/example-private-repo:curl-8.7.1
---
Expand All @@ -54,6 +54,6 @@ spec:
parallel:
matrix:
url: ['https://testkube.io', 'https://docs.testkube.io']
shell: curl '{{ matrix.url }}'
shell: curl -f -LI '{{ matrix.url }}'
container:
image: curlimages/curl:8.7.1
32 changes: 1 addition & 31 deletions test/cypress/executor-tests/crd-workflow/smoke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ spec:
artifacts:
paths:
- '**/*'
events:
- cronjob:
cron: "1 */4 * * *"
---
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
Expand Down Expand Up @@ -76,9 +73,6 @@ spec:
artifacts:
paths:
- '**/*'
events:
- cronjob:
cron: "2 */4 * * *"
---
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
Expand Down Expand Up @@ -114,9 +108,6 @@ spec:
artifacts:
paths:
- '**/*'
events:
- cronjob:
cron: "3 */4 * * *"
---
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
Expand Down Expand Up @@ -148,9 +139,6 @@ spec:
config:
version: 13.5.0
run: "npx cypress run --env NON_CYPRESS_ENV=NON_CYPRESS_ENV_value --config '{\"screenshotsFolder\":\"/data/artifacts/screenshots\",\"videosFolder\":\"/data/artifacts/videos\"}'"
events:
- cronjob:
cron: "4 */4 * * *"
---
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
Expand Down Expand Up @@ -182,9 +170,6 @@ spec:
config:
version: 13.5.0
run: "npx cypress run --env NON_CYPRESS_ENV=NON_CYPRESS_ENV_value --config '{\"screenshotsFolder\":\"/data/artifacts/screenshots\",\"videosFolder\":\"/data/artifacts/videos\"}'"
events:
- cronjob:
cron: "5 */4 * * *"
---
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
Expand Down Expand Up @@ -218,9 +203,6 @@ spec:
config:
version: 13.5.0
run: "npx cypress run --env NON_CYPRESS_ENV=NON_CYPRESS_ENV_value --config '{\"screenshotsFolder\":\"/data/artifacts/screenshots\",\"videosFolder\":\"/data/artifacts/videos\"}'"
events:
- cronjob:
cron: "6 */4 * * *"
---
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
Expand Down Expand Up @@ -259,9 +241,6 @@ spec:
artifacts:
paths:
- '**/*'
events:
- cronjob:
cron: "7 */4 * * *"
---
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
Expand Down Expand Up @@ -304,9 +283,6 @@ spec:
artifacts:
paths:
- '**/*'
events:
- cronjob:
cron: "8 */4 * * *"
---
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
Expand Down Expand Up @@ -355,14 +331,11 @@ spec:
workingDir: /data/artifacts
paths:
- '**/*'
events:
- cronjob:
cron: "10 */4 * * *"
---
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
metadata:
name: cypress-workflow-smoke-matrix
name: cypress-workflow-smoke-matrix-junit
labels:
core-tests: workflows
spec:
Expand Down Expand Up @@ -407,6 +380,3 @@ spec:
workingDir: /data/artifacts
paths:
- '**/*'
events:
- cronjob:
cron: "12 */4 * * *"
53 changes: 53 additions & 0 deletions test/examples/status-page/crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
metadata:
name: tw-testkube-website-5m
spec:
events:
- cronjob:
cron: '*/5 * * * *'
container:
image: curlimages/curl:8.7.1
resources:
requests:
cpu: 32m
memory: 32Mi
steps:
- name: Run tests
shell: curl -f -LI https://testkube.io
---
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
metadata:
name: tw-testkube-docs-5m
spec:
events:
- cronjob:
cron: '*/5 * * * *'
container:
image: curlimages/curl:8.7.1
resources:
requests:
cpu: 32m
memory: 32Mi
steps:
- name: Run tests
shell: curl -f -LI https://docs.testkube.io
---
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
metadata:
name: tw-testkube-blog-5m
spec:
events:
- cronjob:
cron: '*/5 * * * *'
container:
image: curlimages/curl:8.7.1
resources:
requests:
cpu: 32m
memory: 32Mi
steps:
- name: Run tests
shell: curl -f -LI https://testkube.io/blog
80 changes: 80 additions & 0 deletions test/junit/crd-workflow/smoke.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
metadata:
name: junit5-workflow-smoke
labels:
core-tests: workflows
spec:
content:
git:
uri: https://github.com/kubeshop/testkube
revision: workflow-tests-junit # TODO: update
paths:
- test/junit/junit5-project
container:
image: maven:3.9.9-eclipse-temurin-11-alpine
resources:
requests:
cpu: 256m
memory: 256Mi
workingDir: /data/repo/test/junit/junit5-project
steps:
- name: Run tests
shell: mvn test -Dtest=TestSmoke1,TestSmoke2
artifacts:
paths:
- 'target/surefire-reports/**/*'
---
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
metadata:
name: junit5-workflow-smoke-expected-fail
labels:
core-tests: expected-fail
spec:
content:
git:
uri: https://github.com/kubeshop/testkube
revision: workflow-tests-junit # TODO: update
paths:
- test/junit/junit5-project
container:
image: maven:3.9.9-eclipse-temurin-11-alpine
resources:
requests:
cpu: 256m
memory: 256Mi
workingDir: /data/repo/test/junit/junit5-project
steps:
- name: Run tests
shell: mvn test -Dtest=TestSmokeFail
artifacts:
paths:
- 'target/surefire-reports/**/*'
---
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
metadata:
name: junit5-workflow-smoke-mixed-results
labels:
core-tests: expected-fail
spec:
content:
git:
uri: https://github.com/kubeshop/testkube
revision: workflow-tests-junit # TODO: update
paths:
- test/junit/junit5-project
container:
image: maven:3.9.9-eclipse-temurin-11-alpine
resources:
requests:
cpu: 256m
memory: 256Mi
workingDir: /data/repo/test/junit/junit5-project
steps:
- name: Run tests
shell: mvn test
artifacts:
paths:
- 'target/surefire-reports/**/*'
36 changes: 36 additions & 0 deletions test/junit/junit5-project/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>example.testsuite</groupId>
<artifactId>example-testsuite</artifactId>
<version>1.0</version>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.11.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.0</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
</plugin>
</plugins>
</build>
</project>
61 changes: 61 additions & 0 deletions test/junit/junit5-project/src/test/java/TestSmoke1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import java.util.concurrent.TimeUnit;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.BeforeEach;
import static org.junit.jupiter.api.Assertions.*;

public class TestSmoke1 {
@BeforeEach
public void beforeEach() {
try {
TimeUnit.SECONDS.sleep(1);
}
catch(Exception e) {
System.out.println(e);
}
}

@Test
public void test1() {
assertEquals(1, 1);
}

@Test
public void test2() {
assertEquals(1, 1);
}

@Test
public void test3() {
assertEquals(1, 1);
}

@Test
public void test4() {
try {
TimeUnit.SECONDS.sleep(3);
}
catch(Exception e) {
System.out.println(e);
}

assertEquals(1, 1);
}

@Test
public void test5() {
assertEquals(1, 1);
}

@Test
public void test6() {
try {
TimeUnit.SECONDS.sleep(6);
}
catch(Exception e) {
System.out.println(e);
}

assertEquals(1, 1);
}
}
Loading

0 comments on commit 65f6c2a

Please sign in to comment.