Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial proposal for Testing Events #105

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
da4c015
Initial WIP version of Testing Events
olensmar Jan 9, 2023
fe695c1
fixes, removed queued event, added executionId
olensmar Jan 9, 2023
965543f
added optional reason to finished events, loosened testCase type field
olensmar Jan 10, 2023
8fc7ef2
added severity to testCase
olensmar Jan 10, 2023
31e52fe
Update testing-events.md
TheBrunoLopes Jan 13, 2023
2a72822
formatting and added Test Events to README.md
olensmar Jan 15, 2023
2efb0d4
- testing-events updates
olensmar Jan 17, 2023
9ed4181
- added trigger metadata to testCase/testSuite started events
olensmar Jan 18, 2023
950efea
- fixed refs, bumped version of test events
olensmar Jan 19, 2023
284458b
- fixed links to primer
olensmar Jan 19, 2023
141d608
- added environment to testCase/testSuite started events and removed …
olensmar Jan 19, 2023
32da41d
- added schemas and aligned vocabulary
olensmar Jan 19, 2023
3c58cd5
updates in line with meeting discussion/feedback:
olensmar Jan 31, 2023
af33f3d
minor fixes..
olensmar Jan 31, 2023
73cc269
fixed review comments:
olensmar Feb 9, 2023
b00eeed
review comment: changed abort to cancel
olensmar Mar 8, 2023
6832877
review comments: fixed environment examples and spec errors
olensmar Mar 8, 2023
f1e5b55
review comments: extracted objects for testCase/testSuite, added exam…
olensmar Mar 29, 2023
6a8bd2a
added examples and fixed errors
olensmar Mar 30, 2023
9c86a9a
fixed linting and example errors
olensmar Mar 30, 2023
0779d09
fixed linting and example errors
olensmar Mar 30, 2023
69ad13c
fixed linting and example errors
olensmar Mar 30, 2023
9d2f24b
added missing enum and fixed type removal
olensmar Mar 30, 2023
7d1d09d
added missing object properties
olensmar Mar 30, 2023
4a0111a
fixed boolean..
olensmar Mar 30, 2023
833aad2
more review comments..
olensmar Apr 4, 2023
f6ec1b9
fixing stupid mistakes..
olensmar Apr 4, 2023
e9d42bd
removed descriptions
olensmar Apr 14, 2023
ffa8b12
updated deployment object and spec for type to include enum values
olensmar Apr 14, 2023
01a40e5
updated schema version to 0.3.0-draft
olensmar Apr 14, 2023
5316b76
renamed status to outcome
olensmar Apr 17, 2023
d38ac16
removed type from testCaseRun
olensmar Apr 17, 2023
aa13c88
fixed versions and outputType
olensmar Apr 18, 2023
0cedc9f
Update testing-events.md
olensmar Apr 20, 2023
059a9de
fixed wording
olensmar Apr 20, 2023
19e1b6e
Merge branch 'main' of https://github.com/kubeshop/cdevents-spec
olensmar Apr 21, 2023
8c5db20
Merge remote-tracking branch 'upstream/main'
olensmar Apr 21, 2023
edd9029
fixed required outcome property
olensmar Apr 21, 2023
3198d17
fixed required outcome property
olensmar Apr 21, 2023
d0f04b0
Merge branch 'main' of https://github.com/kubeshop/cdevents-spec
olensmar Apr 22, 2023
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ Handling Events associated with Continuous Deployment activities

Handling Events associated with the health of the services deployed and running in a specific environment

### [Testing Events](./testing-events.md)

Handling Events associated with Test execution performed independently or as part of CI/CD pipelines.

### [CloudEvents Binding and Transport](./cloudevents-binding.md)

Defining how CDEvents are mapped to CloudEvents for transportation and delivery
Expand Down
102 changes: 4 additions & 98 deletions continuous-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ This specification defines three subjects in this stage: `builds`, `artifacts` a
| Subject | Description | Predicates |
|---------|-------------|------------|
| [`build`](#build) | A software build | [`queued`](#build-queued), [`started`](#build-started), [`finished`](#build-finished)|
| [`testCase`](#testcase) | A software test case | [`queued`](#testcase-queued), [`started`](#testcase-started), [`finished`](#testcase-finished)|
| [`testSuite`](#testsuite) | A collection of test cases | [`started`](#testsuite-started), [`finished`](#testsuite-finished)|
| [`artifact`](#artifact) | An artifact produced by a build | [`packaged`](#artifact-packaged), [`published`](#artifact-published)|

> `testCase`/`testSuite` events have moved to their own top-level bucket [Testing Events](testing-events.md)

### `build`

A `build` is a process that uses a recipe to produce an artifact from source code.
Expand All @@ -31,35 +31,11 @@ __Note:__ The data model for `builds`, apart from `id` and `source`, only includ

| Field | Type | Description | Examples |
|-------|------|-------------|----------|
| id | `String` | See [id](spec.md#id-subject)| `1234`, `maven123`, `builds/taskrun123` |
| source | `URI-Reference` | See [source](spec.md#source-subject) | `staging/tekton`, `tekton-dev-123`|
| id | `String` | Uniquely identifies the subject within the source. | `1234`, `maven123`, `builds/taskrun123` |
| source | `URI-Reference` | [source](../spec.md#source) from the context | `staging/tekton`, `tekton-dev-123`|
| type | `String` | See [type](spec.md#type-subject) | `build` |
| artifactId | `String` | Identifier of the artifact produced by the build | `pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427`, `pkg:golang/mygit.com/myorg/myapp@234fd47e07d1004f0aed9c` |

### `testCase`

A `testCase` is a process that performs a test against an input software artifact of some kind, for instance source code, a binary, a container image or else. A `testCase` is the smallest unit of testing that the user wants to track. `testCases` are executed, and `testSuites` are for grouping purposes. For this reason, `testCases` can be queued.

__Note:__ The data model for `testCase` only includes `id` and `source`, inputs and outputs of the process are not specified yet, as well as the relation to `testSuite`.

| Field | Type | Description | Examples |
|-------|------|-------------|----------|
| id | `String` | See [id](spec.md#id-subject)| `unitest-abc`, `e2e-test1`, `scan-image1` |
| source | `URI-Reference` | See [source](spec.md#source-subject) | `staging/tekton`, `tekton-dev-123`|
| type | `String` | See [type](spec.md#type-subject) | `testCase` |

### `testSuite`

A `testSuite` represents a set of one or more `testCases`.

__Note:__ The data model for `testSuite` only includes `id` and `source`, inputs and outputs of the process are not specified yet, as well as the relation to `testCase`.

| Field | Type | Description | Examples |
|-------|------|-------------|----------|
| id | `String` | See [id](spec.md#id-subject)| `unit`, `e2e`, `security` |
| source | `URI-Reference` | See [source](spec.md#source-subject) | `staging/tekton`, `tekton-dev-123`|
| type | `String` | See [type](spec.md#type-subject) | `testSuite` |

### `artifact`

An `artifact` is usually produced as output of a build process. Events need to be generated to indicate that an `artifact` has been packaged and released for others to use. These events can be produced by the artifact producer or by the artifact storage system.
Expand Down Expand Up @@ -116,76 +92,6 @@ This event represents a Build task that has finished. This event will eventually
| type | `String` | See [type](spec.md#type-subject) | |
| artifactId | `Purl` | Identifier of the artifact produced by the build | `pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427`, `pkg:golang/mygit.com/myorg/myapp@234fd47e07d1004f0aed9c` | `build` | |

### `testCase queued`

This event represents a Test task that has been queued, and it is waiting to be started.

- Event Type: __`dev.cdevents.testcase.queued.0.1.1`__
- Predicate: queued
- Subject: [`testCase`](#testcase)

| Field | Type | Description | Examples | Required |
|-------|------|-------------|----------|----------------------------|
| id | `String` | See [id](spec.md#id-subject)| `unitest-abc`, `e2e-test1`, `scan-image1` | ✅ |
| source | `URI-Reference` | See [source](spec.md#source-subject) | | |
| type | `String` | See [type](spec.md#type-subject) | `testCase` | |

### `testCase started`

This event represents a Test task that has started.

- Event Type: __`dev.cdevents.testcase.started.0.1.1`__
- Predicate: started
- Subject: [`testCase`](#testcase)

| Field | Type | Description | Examples | Required |
|-------|------|-------------|----------|----------------------------|
| id | `String` | See [id](spec.md#id-subject)| `unitest-abc`, `e2e-test1`, `scan-image1` | ✅ |
| source | `URI-Reference` | See [source](spec.md#source-subject) | | |
| type | `String` | See [type](spec.md#type-subject) | `testCase` | |

### `testCase finished`

This event represents a Test task that has finished. This event will eventually contain the finished status: success, error or failure.

- Event Type: __`dev.cdevents.testcase.finished.0.1.1`__
- Predicate: finished
- Subject: [`testCase`](#testcase)

| Field | Type | Description | Examples | Required |
|-------|------|-------------|----------|----------------------------|
| id | `String` | See [id](spec.md#id-subject)| `unitest-abc`, `e2e-test1`, `scan-image1` | ✅ |
| source | `URI-Reference` | See [source](spec.md#source-subject) | | |
| type | `String` | See [type](spec.md#type-subject) | `testCase` | |

### `testSuite started`

This event represents a Test suite that has been started.

- Event Type: __`dev.cdevents.testsuite.started.0.1.1`__
- Predicate: started
- Subject: [`testSuite`](#testsuite)

| Field | Type | Description | Examples | Required |
|-------|------|-------------|----------|----------------------------|
| id | `String` | See [id](spec.md#id-subject)| `unit`, `e2e`, `security` | ✅ |
| source | `URI-Reference` | See [source](spec.md#source-subject) | | |
| type | `String` | See [type](spec.md#type-subject) | `testSuite` | |

### `testSuite finished`

This event represents a Test suite that has has finished, the event will contain the finished status: success, error or failure.

- Event Type: __`dev.cdevents.testsuite.finished.0.1.1`__
- Predicate: finished
- Subject: [`testSuite`](#testsuite)

| Field | Type | Description | Examples | Required |
|-------|------|-------------|----------|----------------------------|
| id | `String` | See [id](spec.md#id-subject)| `unit`, `e2e`, `security` | ✅ |
| source | `URI-Reference` | See [source](spec.md#source-subject) | | |
| type | `String` | See [type](spec.md#type-subject) | `testSuite` | |

### `artifact packaged`

The event represents an artifact that has been packaged for distribution; this artifact is now versioned with a fixed version.
Expand Down
15 changes: 0 additions & 15 deletions examples/testcase_finished.json

This file was deleted.

15 changes: 0 additions & 15 deletions examples/testcase_queued.json

This file was deleted.

15 changes: 0 additions & 15 deletions examples/testcase_started.json

This file was deleted.

27 changes: 27 additions & 0 deletions examples/testcaserun_finished.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.testcaserun.finished.0.3.0-draft",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "myTestCaseRun123",
"source": "/event/source/123",
"type": "testCaseRun",
"content": {
"outcome" : "pass",
"environment": {
"id": "dev",
"source": "testkube-dev-123"
},
"testCase": {
"id": "92834723894",
"version": "1.0",
"name": "Login Test",
"type": "integration"
}
}
}
}
29 changes: 29 additions & 0 deletions examples/testcaserun_queued.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.testcaserun.queued.0.3.0-draft",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "myTestCaseRun123",
"source": "/event/source/123",
"type": "testCaseRun",
"content": {
"environment": {
"id": "dev",
"source": "testkube-dev-123"
},
"testCase": {
"id": "92834723894",
"version": "1.0",
"name": "Login Test",
"type": "integration"
},
"trigger": {
"type": "schedule"
}
}
}
}
29 changes: 29 additions & 0 deletions examples/testcaserun_started.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.testcaserun.started.0.3.0-draft",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "myTestCaseRun123",
"source": "/event/source/123",
"type": "testCaseRun",
"content": {
"environment": {
"id": "dev",
"source": "testkube-dev-123"
},
"testCase": {
"id": "92834723894",
"version": "1.0",
"name": "Login Test",
"type": "integration"
},
"trigger": {
"type": "schedule"
}
}
}
}
22 changes: 22 additions & 0 deletions examples/testoutput_published.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.testoutput.published.0.3.0-draft",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "testrunreport-12123",
"source": "/event/source/testrunreport-12123",
"type": "testOutput",
"content": {
"outputType" : "video",
"format" : "video/quicktime",
"testCaseRun": {
"id": "myTestCaseRun123",
"source": "testkube-dev-123"
}
}
}
}
15 changes: 0 additions & 15 deletions examples/testsuite_finished.json

This file was deleted.

15 changes: 0 additions & 15 deletions examples/testsuite_started.json

This file was deleted.

28 changes: 28 additions & 0 deletions examples/testsuiterun_finished.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"context": {
"version": "0.2.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The schema release we're now aiming at is 0.3.0, and therefore this version field should state "0.3.0-draft". The same comment is valid for all example files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spec version is 0.3.0, the event version is 0.1.0, so:

.context.version should be set to 0.3.0-draft
.context.type should be reverted to dev.cdevents.testsuiterun.finished.0.1.0-draft

"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.testsuiterun.finished.0.3.0-draft",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "myTestSuiteRun123",
"source": "/event/source/123",
"type": "testSuiteRun",
"content": {
"outcome" : "fail",
"severity" : "critical",
"reason" : "Host 123.34.23.32 not found",
"environment": {
"id": "dev",
"source": "testkube-dev-123"
},
"testSuite": {
"id": "92834723894",
"version": "1.0",
"name": "Auth TestSuite"
}
}
}
}
28 changes: 28 additions & 0 deletions examples/testsuiterun_queued.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.testsuiterun.queued.0.3.0-draft",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "myTestSuiteRun123",
"source": "/event/source/123",
"type": "testSuiteRun",
"content": {
"environment": {
"id": "dev",
"source": "testkube-dev-123"
},
"testSuite": {
"id": "92834723894",
"version": "1.0",
"name": "Auth TestSuite"
},
"trigger": {
"type": "pipeline"
}
}
}
}
Loading