Skip to content

Commit

Permalink
Merge branch 'main' into use-applynamespace
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredoconnell committed May 13, 2024
2 parents aa395f0 + 75206a1 commit 9bb8e62
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
go.arcalot.io/log/v2 v2.1.0
go.flow.arcalot.io/deployer v0.6.0-beta1
go.flow.arcalot.io/dockerdeployer v0.7.0
go.flow.arcalot.io/expressions v0.4.1
go.flow.arcalot.io/expressions v0.4.2
go.flow.arcalot.io/kubernetesdeployer v0.9.1
go.flow.arcalot.io/pluginsdk v0.12.0
go.flow.arcalot.io/podmandeployer v0.11.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ go.flow.arcalot.io/deployer v0.6.0-beta1 h1:6wVGi/D5rHcT1pnQETg9ZAq5PCxArPwg0MNj
go.flow.arcalot.io/deployer v0.6.0-beta1/go.mod h1:MDaDc9xDRjQN5TyTvvKMXipc5Khe8NLOnUjh31Nm0wU=
go.flow.arcalot.io/dockerdeployer v0.7.0 h1:zQi/r5FVi1MBD4Z+I9l0i4nUQvjBSaZXdhtVKs3zPcM=
go.flow.arcalot.io/dockerdeployer v0.7.0/go.mod h1:xIPCRSnyb/JEitUzsY2deWa7VwVZJd+opLNcFTcrN8U=
go.flow.arcalot.io/expressions v0.4.1 h1:WOl3DtDcWAmPKupwYxJV3bVYKPoMgAmQbECfiUgv/0s=
go.flow.arcalot.io/expressions v0.4.1/go.mod h1:FA/50wX1+0iTgW/dFeeE1yOslZSmfBaMNR4IiMYRwxc=
go.flow.arcalot.io/expressions v0.4.2 h1:nEfxpWGEG1+59CoiAnS3AUQ+j2RZcUSPhPGjwPd+wOA=
go.flow.arcalot.io/expressions v0.4.2/go.mod h1:FA/50wX1+0iTgW/dFeeE1yOslZSmfBaMNR4IiMYRwxc=
go.flow.arcalot.io/kubernetesdeployer v0.9.1 h1:AGnJFazehAENXxGMCF0Uc7aG9F0LpvuhoyQFu8deJG0=
go.flow.arcalot.io/kubernetesdeployer v0.9.1/go.mod h1:yvxT3VwmyrlIi4422pxl02z4QeU2Gvbjg5aQB17Ye4s=
go.flow.arcalot.io/pluginsdk v0.12.0 h1:NJyPMluwtljsNjEEewCeuxE2dGuAJn89KvU52o9OAvU=
Expand Down
39 changes: 39 additions & 0 deletions workflow/workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,45 @@ func TestDelayedDisabledStepWorkflow(t *testing.T) {
assert.Equals(t, toggledOutputMap["message"], "Step toggled_wait/wait disabled")
}

var testExpressionWithExtraWhitespace = `
version: v0.2.0
input:
root: RootObject
objects:
RootObject:
id: RootObject
properties: {}
steps:
wait_1:
plugin:
src: "n/a"
deployment_type: "builtin"
step: wait
input:
wait_time_ms: 0
outputs:
a:
leading-whitespace: !expr " $.steps.wait_1.outputs.success.message"
trailing-whitespace: !expr "$.steps.wait_1.outputs.success.message "
# Use | instead of |- to keep the newline at the end.
trailing-newline: !expr |
$.steps.wait_1.outputs.success.message
`

func TestExpressionWithWhitespace(t *testing.T) {
preparedWorkflow := assert.NoErrorR[workflow.ExecutableWorkflow](t)(
getTestImplPreparedWorkflow(t, testExpressionWithExtraWhitespace),
)
outputID, outputData, err := preparedWorkflow.Execute(context.Background(), map[string]any{})
assert.NoError(t, err)
assert.Equals(t, outputID, "a")
assert.Equals(t, outputData.(map[any]any), map[any]any{
"leading-whitespace": "Plugin slept for 0 ms.",
"trailing-whitespace": "Plugin slept for 0 ms.",
"trailing-newline": "Plugin slept for 0 ms.",
})
}

func createTestExecutableWorkflow(t *testing.T, workflowStr string, workflowCtx map[string][]byte) (workflow.ExecutableWorkflow, error) {
logConfig := log.Config{
Level: log.LevelDebug,
Expand Down

0 comments on commit 9bb8e62

Please sign in to comment.