-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add E2E tests for Jira add comment sink Kamelet
- Loading branch information
1 parent
06d6447
commit 88798a4
Showing
6 changed files
with
169 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"self": "yaks:resolveURL('jira-service')/rest/api/latest/issue/${jira.issue.id}/comment/${jira.issue.comment.id}", | ||
"id": "${jira.issue.comment.id}", | ||
"author": { | ||
"self": "yaks:resolveURL('jira-service')/rest/api/latest/user?username=yaks", | ||
"name": "yaks", | ||
"displayName": "YAKS User", | ||
"active": false | ||
}, | ||
"body": "${jira.issue.comment}", | ||
"updateAuthor": { | ||
"self": "yaks:resolveURL('jira-service')/rest/api/latest/user?username=yaks", | ||
"name": "yaks", | ||
"displayName": "YAKS User", | ||
"active": false | ||
}, | ||
"created": "yaks:currentDate(yyyy-MM-dd'T'HH:mm:ss.SZ)", | ||
"updated": "yaks:currentDate(yyyy-MM-dd'T'HH:mm:ss.SZ)", | ||
"visibility": { | ||
"type": "role", | ||
"value": "Users" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
apiVersion: camel.apache.org/v1 | ||
kind: Pipe | ||
metadata: | ||
name: jira-add-comment-sink-pipe | ||
spec: | ||
source: | ||
ref: | ||
kind: Kamelet | ||
apiVersion: camel.apache.org/v1 | ||
name: timer-source | ||
properties: | ||
period: ${timer.source.period} | ||
message: '${jira.issue.comment}' | ||
steps: | ||
- ref: | ||
kind: Kamelet | ||
apiVersion: camel.apache.org/v1 | ||
name: insert-header-action | ||
properties: | ||
name: issueKey | ||
value: ${jira.issue.key} | ||
- ref: | ||
kind: Kamelet | ||
apiVersion: camel.apache.org/v1 | ||
name: log-action | ||
properties: | ||
showHeaders: true | ||
sink: | ||
ref: | ||
kind: Kamelet | ||
apiVersion: camel.apache.org/v1 | ||
name: jira-add-comment-sink | ||
properties: | ||
jiraUrl: yaks:resolveURL('jira-service') | ||
username: ${jira.username} | ||
password: ${jira.password} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
Feature: Jira Kamelet - Sink | ||
|
||
Background: | ||
Given variables | ||
| timer.source.period | 10000 | | ||
| jira.project.key | CAMEL | | ||
| jira.project.id | 10001 | | ||
| jira.issue.id | 10001 | | ||
| jira.issue.key | CAMEL-10001 | | ||
| jira.issue.summary | New bug, citrus:randomString(10) | | ||
| jira.issue.assignee | Superman | | ||
| jira.issue.type | Bug | | ||
| jira.issue.description | Sample bug | | ||
| jira.issue.comment | New comment, citrus:randomString(10) | | ||
| jira.issue.comment.id | 10001 | | ||
| jira.username | yaks | | ||
| jira.password | secr3t | | ||
Given HTTP server timeout is 120000 ms | ||
Given HTTP server "jira-service" | ||
|
||
Scenario: Create Http server | ||
Given create Kubernetes service jira-service | ||
|
||
Scenario: Verify Jira events | ||
# Create binding | ||
Given load Pipe jira-add-comment-sink-pipe.yaml | ||
# Verify get issue request | ||
Given expect HTTP request header: Authorization="Basic citrus:encodeBase64(${jira.username}:${jira.password})" | ||
When receive GET /rest/api/latest/issue/${jira.issue.key} | ||
Then HTTP response header: Content-Type="application/json" | ||
And HTTP response body: yaks:readFile('jira-get-issue-response.json') | ||
Then send HTTP 200 OK | ||
# Verify add comment request | ||
Given expect HTTP request header: Authorization="Basic citrus:encodeBase64(${jira.username}:${jira.password})" | ||
When receive GET /rest/api/latest/serverInfo | ||
Then HTTP response body: yaks:readFile('jira-server-info.json') | ||
Then send HTTP 200 OK | ||
# Verify add comment request | ||
Given expect HTTP request header: Authorization="Basic citrus:encodeBase64(${jira.username}:${jira.password})" | ||
Then expect HTTP request body | ||
""" | ||
{ | ||
"body": "${jira.issue.comment}" | ||
} | ||
""" | ||
When receive POST /rest/api/latest/issue/${jira.issue.key}/comment | ||
Then HTTP response body: yaks:readFile('jira-add-comment-response.json') | ||
Then send HTTP 200 OK | ||
# Verify event | ||
And Camel K integration jira-add-comment-sink-pipe should print ${jira.issue.comment} | ||
|
||
Scenario: Remove resources | ||
# Remove Camel K binding | ||
Given delete Pipe jira-add-comment-sink-pipe | ||
Given delete Kubernetes service jira-service | ||
And stop server component jira-service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"expand": "schema,names", | ||
"id": "${jira.issue.id}", | ||
"key": "${jira.issue.key}", | ||
"self": "yaks:resolveURL('jira-service')/rest/api/latest/issue/${jira.issue.key}", | ||
"transitions": "yaks:resolveURL('jira-service')/rest/api/latest/issue/${jira.issue.key}/transitions", | ||
"names": {}, | ||
"schema": {}, | ||
"fields": { | ||
"project": { | ||
"self": "yaks:resolveURL('jira-service')/rest/api/latest/project/${jira.project.id}", | ||
"id": "${jira.project.id}", | ||
"key": "CAMEL" | ||
}, | ||
"summary": "${jira.issue.summary}", | ||
"custom": "${jira.issue.key}", | ||
"issuetype": { | ||
"self": "yaks:resolveURL('jira-service')/rest/api/latest/issuetype/3", | ||
"id": "3", | ||
"description": "A task that needs to be done.", | ||
"iconUrl": "yaks:resolveURL('jira-service')/images/icons/task.gif", | ||
"name": "Task", | ||
"subtask": false | ||
}, | ||
"created": "yaks:currentDate(yyyy-MM-dd'T'HH:mm:ss.SZ)", | ||
"updated": "yaks:currentDate(yyyy-MM-dd'T'HH:mm:ss.SZ)", | ||
"status": { | ||
"self": "yaks:resolveURL('jira-service')/rest/api/latest/status/1", | ||
"id": 1, | ||
"description": "Open task.", | ||
"iconUrl": "yaks:resolveURL('jira-service')/images/icons/status_1.gif", | ||
"name": "Open" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"baseUrl": "yaks:resolveURL('jira-service')", | ||
"version": "5.0.0", | ||
"versionNumbers": [ | ||
5, | ||
0, | ||
0 | ||
], | ||
"buildNumber": 581, | ||
"buildDate": "yaks:currentDate(yyyy-MM-dd'T'HH:mm:ss.SZ)", | ||
"serverTime": "yaks:currentDate(yyyy-MM-dd'T'HH:mm:ss.SZ)", | ||
"scmInfo": "yaks:randomString(40, LOWERCASE)", | ||
"buildPartnerName": "YAKS Co.", | ||
"serverTitle": "Test Jira Server" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters