Skip to content

Commit

Permalink
chore: add sanity check from plugin repository
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Feb 10, 2025
1 parent 883dbb6 commit 864969d
Show file tree
Hide file tree
Showing 10 changed files with 278 additions and 0 deletions.
30 changes: 30 additions & 0 deletions sanitychecks/plugin/plugin-compress/archive.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
id: archive
namespace: qa

tasks:
- id: download
type: io.kestra.plugin.core.http.Download
uri: https://sample-files.com/downloads/compressed/zip/basic-text.zip

- id: decompress
type: io.kestra.plugin.compress.ArchiveDecompress
from: "{{ outputs.download.uri }}"
algorithm: ZIP

- id: assertFiles
type: io.kestra.plugin.core.execution.Fail
condition: "{{ outputs.decompress.files | length != 6}}"

- id: compress
type: io.kestra.plugin.compress.ArchiveCompress
from: "{{ outputs.decompress.files }}"
algorithm: JAR

- id: decompress2
type: io.kestra.plugin.compress.ArchiveDecompress
from: "{{ outputs.compress.uri }}"
algorithm: JAR

- id: assertContent
type: io.kestra.plugin.core.execution.Fail
condition: '{{ read(outputs.decompress2.files["readme.txt"]) != "This sample ZIP file is provided by Sample-Files.com. Visit us for more sample files and resources."}}'
13 changes: 13 additions & 0 deletions sanitychecks/plugin/plugin-fs/download.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
id: download
namespace: qa

tasks:
- id: download
type: io.kestra.plugin.core.http.Download
uri: https://huggingface.co/datasets/kestra/datasets/raw/main/csv/orders.csv

- id: assert
type: io.kestra.plugin.core.execution.Assert
conditions:
- "{{ outputs.download.length == 5837 }}"
- "{{ outputs.download.code == 200 }}"
13 changes: 13 additions & 0 deletions sanitychecks/plugin/plugin-fs/request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
id: request
namespace: qa

tasks:
- id: request
type: io.kestra.plugin.core.http.Request
uri: https://dummyjson.com/products

- id: assert
type: io.kestra.plugin.core.execution.Assert
conditions:
- "{{ outputs.request.code == 200 }}"
- "{{ json(outputs.request.body).products[0].id == 1}}"
34 changes: 34 additions & 0 deletions sanitychecks/plugin/plugin-redis/all.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
id: all
namespace: sanitycheck.plugin.redis

tasks:
- id: init
type: io.kestra.plugin.core.output.OutputValues
values:
randomPort: "{{ randomPort() }}"

- id: dockerStart
type: io.kestra.plugin.docker.Run
containerImage: redis
portBindings:
- "{{ outputs.init.values.randomPort }}:6379"
wait: false

- id: parallel
type: io.kestra.plugin.core.flow.ForEach
values: ["keys-json", "keys-string", "list-json", "list-string"]
concurrencyLimit: 0
tasks:
- id: subflow
type: io.kestra.plugin.core.flow.Subflow
namespace: "{{ flow.namespace }}"
flowId: "{{ taskrun.value }}"
wait: true
transmitFailed: true
inputs:
cs: "redis://:redis@localhost:{{ outputs.init.values.randomPort }}/0"

finally:
- id: dockerStop
type: io.kestra.plugin.docker.Stop
containerId: "{{ outputs.dockerStart.taskRunner.containerId }}"
32 changes: 32 additions & 0 deletions sanitychecks/plugin/plugin-redis/keys-json.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
id: keys-json
namespace: sanitycheck.plugin.redis

inputs:
- id: cs
type: STRING
defaults: "redis://:redis@localhost:6379/0"

tasks:
- id: set
type: io.kestra.plugin.redis.string.Set
url: "{{ inputs.cs }}"
serdeType: JSON
key: "key_json_{{ execution.id }}"
value: |
{{ {
"flow": flow.id,
"namespace": flow.namespace
} | toJson }}
- id: get
type: io.kestra.plugin.redis.string.Get
url: "{{ inputs.cs }}"
serdeType: JSON
key: "key_json_{{ execution.id }}"

- id: assert
type: io.kestra.plugin.core.execution.Assert
errorMessage: "Invalid get data {{ outputs.get.data.flow }}"
conditions:
- "{{ outputs.get.data.flow == flow.id }}"
- "{{ outputs.get.data.namespace == flow.namespace }}"
45 changes: 45 additions & 0 deletions sanitychecks/plugin/plugin-redis/keys-string.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
id: keys-string
namespace: sanitycheck.plugin.redis

inputs:
- id: cs
type: STRING
defaults: "redis://:redis@localhost:6379/0"

tasks:
- id: set
type: io.kestra.plugin.redis.string.Set
url: "{{ inputs.cs }}"
key: "key_string_{{ execution.id }}"
value: "{{ flow.id }}"
serdeType: STRING

- id: get
type: io.kestra.plugin.redis.string.Get
url: "{{ inputs.cs }}"
key: "key_string_{{ execution.id }}"
serdeType: STRING

- id: assert
type: io.kestra.plugin.core.execution.Assert
errorMessage: "Invalid get data {{ outputs.get }}"
conditions:
- "{{ outputs.get.data == flow.id }}"

- id: delete
type: io.kestra.plugin.redis.string.Delete
url: "{{ inputs.cs }}"
keys:
- "key_string_{{ execution.id }}"

- id: getAfterDelete
type: io.kestra.plugin.redis.string.Get
url: "{{ inputs.cs }}"
key: "key_string_{{ execution.id }}"
serdeType: STRING

- id: assertAfterDelete
type: io.kestra.plugin.core.execution.Assert
errorMessage: "Invalid get data {{ outputs.getAfterDelete }}"
conditions:
- "{{ (outputs.getAfterDelete contains 'data') == false }}"
35 changes: 35 additions & 0 deletions sanitychecks/plugin/plugin-redis/list-json.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
id: list-json
namespace: sanitycheck.plugin.redis

inputs:
- id: cs
type: STRING
defaults: "redis://:redis@localhost:6379/0"

tasks:
- id: push
type: io.kestra.plugin.redis.list.ListPush
url: "{{ inputs.cs }}"
serdeType: JSON
key: "list_json_{{ execution.id }}"
from:
- |
{{ {
"flow": flow.id,
"namespace": flow.namespace
} | toJson }}
- id: pop
type: io.kestra.plugin.redis.list.ListPop
url: "{{ inputs.cs }}"
serdeType: JSON
key: "list_json_{{ execution.id }}"
maxRecords: 1

- id: assert
type: io.kestra.plugin.core.execution.Assert
errorMessage: "Invalid get data {{ outputs.pop }} with uri data {{ fromIon(read(outputs.pop.uri)) }}"
conditions:
- "{{ outputs.pop.count == 1 }}"
- "{{ fromIon(read(outputs.pop.uri)).flow == flow.id }}"
- "{{ fromIon(read(outputs.pop.uri)).namespace == flow.namespace }}"
32 changes: 32 additions & 0 deletions sanitychecks/plugin/plugin-redis/list-string.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
id: list-string
namespace: sanitycheck.plugin.redis

inputs:
- id: cs
type: STRING
defaults: "redis://:redis@localhost:6379/0"

tasks:
- id: push
type: io.kestra.plugin.redis.list.ListPush
url: "{{ inputs.cs }}"
key: "list_string_{{ execution.id }}"
serdeType: STRING
from:
- "{{ execution.id }}"
- "{{ flow.id }}"

- id: pop
type: io.kestra.plugin.redis.list.ListPop
url: "{{ inputs.cs }}"
key: "list_string_{{ execution.id }}"
serdeType: STRING
maxRecords: 2

- id: assert
type: io.kestra.plugin.core.execution.Assert
errorMessage: "Invalid get data {{ outputs.pop }}"
conditions:
- "{{ outputs.pop.count == 2 }}"
- "{{ fromIon(read(outputs.pop.uri), allRows=true) contains execution.id }}"
- "{{ fromIon(read(outputs.pop.uri), allRows=true) contains flow.id }}"
19 changes: 19 additions & 0 deletions sanitychecks/plugin/plugin-serdes/csv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
id: csv_to_ion
namespace: qa

tasks:
- id: create_csv
type: io.kestra.plugin.core.http.Download
uri: https://huggingface.co/datasets/kestra/datasets/raw/main/csv/orders.csv

- id: convert_to_ion
type: io.kestra.plugin.serdes.csv.CsvToIon
from: "{{ outputs.create_csv.uri}}"

- id: assertIon
type: io.kestra.plugin.core.execution.Fail
condition: '{{ fromIon(read(outputs.convert_to_ion.uri)).order_id != "1"}}'

- id: ion_to_csv
type: io.kestra.plugin.serdes.csv.IonToCsv
from: "{{ outputs.convert_to_ion.uri }}"
25 changes: 25 additions & 0 deletions sanitychecks/plugin/plugin-serdes/excel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
id: ion_to_excel
namespace: qa
variables:
sheet_title: my_sheet-123
tasks:
- id: create_csv
type: io.kestra.plugin.core.http.Download
uri: https://huggingface.co/datasets/kestra/datasets/raw/main/csv/orders.csv

- id: convert_to_ion
type: io.kestra.plugin.serdes.csv.CsvToIon
from: "{{ outputs.create_csv.uri}}"


- id: convert_to_excel
type: io.kestra.plugin.serdes.excel.IonToExcel
from: "{{ outputs.convert_to_ion.uri}}"
sheetsTitle: "{{ vars.sheet_title }}"


- id: excel_to_ion
type: io.kestra.plugin.serdes.excel.ExcelToIon
from: "{{ outputs.convert_to_excel.uri }}"
sheetsTitle:
- "{{ vars.sheet_title }}"

0 comments on commit 864969d

Please sign in to comment.