Merge pull request #529 from grouville/dagger_compute-out_of_bound
dagger compute out-of-bound
This commit is contained in:
commit
413dec63a0
@ -43,6 +43,10 @@ var computeCmd = &cobra.Command{
|
||||
|
||||
for _, input := range viper.GetStringSlice("input-string") {
|
||||
parts := strings.SplitN(input, "=", 2)
|
||||
if len(parts) != 2 {
|
||||
lg.Fatal().Msgf("failed to parse input: input-string")
|
||||
}
|
||||
|
||||
k, v := parts[0], parts[1]
|
||||
err := st.SetInput(k, state.TextInput(v))
|
||||
if err != nil {
|
||||
@ -56,6 +60,10 @@ var computeCmd = &cobra.Command{
|
||||
|
||||
for _, input := range viper.GetStringSlice("input-dir") {
|
||||
parts := strings.SplitN(input, "=", 2)
|
||||
if len(parts) != 2 {
|
||||
lg.Fatal().Msgf("failed to parse input: input-dir")
|
||||
}
|
||||
|
||||
k, v := parts[0], parts[1]
|
||||
err := st.SetInput(k, state.DirInput(v, []string{}, []string{}))
|
||||
if err != nil {
|
||||
@ -69,6 +77,10 @@ var computeCmd = &cobra.Command{
|
||||
|
||||
for _, input := range viper.GetStringSlice("input-git") {
|
||||
parts := strings.SplitN(input, "=", 2)
|
||||
if len(parts) != 2 {
|
||||
lg.Fatal().Msgf("failed to parse input: input-git")
|
||||
}
|
||||
|
||||
k, v := parts[0], parts[1]
|
||||
err := st.SetInput(k, state.GitInput(v, "", ""))
|
||||
if err != nil {
|
||||
|
@ -65,6 +65,18 @@ setup() {
|
||||
run "$DAGGER" compute --input-string 'in=foobar' "$TESTDIR"/compute/input/default
|
||||
assert_success
|
||||
assert_line '{"in":"foobar","test":"received: foobar"}'
|
||||
|
||||
run "$DAGGER" compute --input-string=foobar "$TESTDIR"/compute/input/default
|
||||
assert_failure
|
||||
assert_output --partial 'failed to parse input: input-string'
|
||||
|
||||
run "$DAGGER" compute --input-dir=foobar "$TESTDIR"/compute/input/default
|
||||
assert_failure
|
||||
assert_output --partial 'failed to parse input: input-dir'
|
||||
|
||||
run "$DAGGER" compute --input-git=foobar "$TESTDIR"/compute/input/default
|
||||
assert_failure
|
||||
assert_output --partial 'failed to parse input: input-git'
|
||||
}
|
||||
|
||||
@test "compute: secrets" {
|
||||
|
Reference in New Issue
Block a user