This commit is contained in:
46
tests/v1.0/karate-event.yaml
Normal file
46
tests/v1.0/karate-event.yaml
Normal file
@@ -0,0 +1,46 @@
|
||||
url: ""
|
||||
functions:
|
||||
- type: subflow
|
||||
id: call-karate
|
||||
workflow: karate
|
||||
start:
|
||||
type: event
|
||||
state: call-subflow
|
||||
event:
|
||||
type: io.direktiv.function.test
|
||||
context:
|
||||
function: 'export-xlsx'
|
||||
version: '1.0'
|
||||
states:
|
||||
- id: call-subflow
|
||||
type: action
|
||||
action:
|
||||
function: call-karate
|
||||
input:
|
||||
host: jq(."io.direktiv.function.test".host)
|
||||
catch:
|
||||
- error: "*"
|
||||
transition: report-failure
|
||||
transition: report-success
|
||||
- id: report-success
|
||||
type: generateEvent
|
||||
event:
|
||||
type: io.direktiv.function.test.result.karate
|
||||
source: karate
|
||||
data: ''
|
||||
context:
|
||||
result: success
|
||||
function: jq(."io.direktiv.function.test".function)
|
||||
version: jq(."io.direktiv.function.test".version)
|
||||
- id: report-failure
|
||||
type: generateEvent
|
||||
event:
|
||||
type: io.direktiv.function.test.result.karate
|
||||
source: karate
|
||||
data: jq(.error)
|
||||
context:
|
||||
result: failure
|
||||
function: jq(."io.direktiv.function.test".function)
|
||||
version: jq(."io.direktiv.function.test".version)
|
||||
|
||||
|
22
tests/v1.0/karate.yaml
Normal file
22
tests/v1.0/karate.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
url: ""
|
||||
functions:
|
||||
- type: knative-workflow
|
||||
id: karate
|
||||
image: gcr.io/direktiv/functions/karate:1.0
|
||||
states:
|
||||
- id: run-test
|
||||
type: action
|
||||
action:
|
||||
function: karate
|
||||
input:
|
||||
commands:
|
||||
- command: java -DtestURL=jq(.host) -Dexport-xlsxSecret=jq(.secrets.export-xlsxSecret)
|
||||
-jar /karate.jar test.feature
|
||||
print: false
|
||||
- command: cat target/karate-reports/karate-summary-json.txt
|
||||
logging: info
|
||||
secrets:
|
||||
- export-xlsxSecret
|
||||
files:
|
||||
- key: test.feature
|
||||
scope: workflow
|
41
tests/v1.0/karate.yaml.test.feature
Normal file
41
tests/v1.0/karate.yaml.test.feature
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
Feature: Basic
|
||||
|
||||
# The secrects can be used in the payload with the following syntax #(mysecretname)
|
||||
Background:
|
||||
* def export-xlsxSecret = karate.properties['export-xlsxSecret']
|
||||
|
||||
|
||||
Scenario: get request
|
||||
|
||||
Given url karate.properties['testURL']
|
||||
|
||||
And path '/'
|
||||
And header Direktiv-ActionID = 'development'
|
||||
And header Direktiv-TempDir = '/tmp'
|
||||
And request
|
||||
"""
|
||||
{
|
||||
"commands": [
|
||||
{
|
||||
"command": "ls -la",
|
||||
"silent": true,
|
||||
"print": false,
|
||||
}
|
||||
]
|
||||
}
|
||||
"""
|
||||
When method POST
|
||||
Then status 200
|
||||
And match $ ==
|
||||
"""
|
||||
{
|
||||
"export-xlsx": [
|
||||
{
|
||||
"result": "#notnull",
|
||||
"success": true
|
||||
}
|
||||
]
|
||||
}
|
||||
"""
|
||||
|
44
tests/v1.0/tests-event.yaml
Normal file
44
tests/v1.0/tests-event.yaml
Normal file
@@ -0,0 +1,44 @@
|
||||
url: ""
|
||||
functions:
|
||||
- type: subflow
|
||||
id: call-tests
|
||||
workflow: tests
|
||||
start:
|
||||
type: event
|
||||
state: call-subflow
|
||||
event:
|
||||
type: io.direktiv.function.test
|
||||
context:
|
||||
function: 'export-xlsx'
|
||||
version: '1.0'
|
||||
states:
|
||||
- id: call-subflow
|
||||
type: action
|
||||
action:
|
||||
function: call-tests
|
||||
catch:
|
||||
- error: "*"
|
||||
transition: report-failure
|
||||
transition: report-success
|
||||
- id: report-success
|
||||
type: generateEvent
|
||||
event:
|
||||
type: io.direktiv.function.test.result
|
||||
source: tests
|
||||
data: ''
|
||||
context:
|
||||
result: success
|
||||
function: jq(."io.direktiv.function.test".function)
|
||||
version: jq(."io.direktiv.function.test".version)
|
||||
- id: report-failure
|
||||
type: generateEvent
|
||||
event:
|
||||
type: io.direktiv.function.test.result
|
||||
source: tests
|
||||
data: jq(.error)
|
||||
context:
|
||||
result: failure
|
||||
function: jq(."io.direktiv.function.test".function)
|
||||
version: jq(."io.direktiv.function.test".version)
|
||||
|
||||
|
16
tests/v1.0/tests.yaml
Normal file
16
tests/v1.0/tests.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
url: ""
|
||||
functions:
|
||||
- type: knative-workflow
|
||||
id: export-xlsx
|
||||
image: registry.coadcorp.com/export-xlsx:test
|
||||
states:
|
||||
- id: state0
|
||||
type: action
|
||||
action:
|
||||
function: export-xlsx
|
||||
input:
|
||||
files:
|
||||
- data: "jq(.input) \n"
|
||||
name: /tmp/input.json
|
||||
out-filename: example.xlsx
|
||||
worksheet-name: TestSpreadsheet
|
Reference in New Issue
Block a user