-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(workflows): tweaks to image and video jobs
feat: tweaks to image and video jobs
- Loading branch information
1 parent
1521be7
commit 9697b33
Showing
3 changed files
with
127 additions
and
8 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
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,57 @@ | ||
package run | ||
|
||
import ( | ||
"context" | ||
"os" | ||
"testing" | ||
|
||
"time" | ||
|
||
"github.com/bacalhau-project/amplify/pkg/cli" | ||
"github.com/bacalhau-project/amplify/pkg/config" | ||
"github.com/bacalhau-project/amplify/pkg/executor" | ||
"github.com/spf13/cobra" | ||
"gotest.tools/assert" | ||
) | ||
|
||
func TestRunCommand(t *testing.T) { | ||
tempFile := t.TempDir() + "/config.yaml" | ||
err := os.WriteFile(tempFile, []byte(`jobs: | ||
- id: my-foo-job | ||
graph: | ||
- id: my-foo-node | ||
job_id: my-foo-job | ||
inputs: | ||
- root: true # Identifies that this is a root node | ||
`), 0644) | ||
assert.NilError(t, err) | ||
|
||
appContext := cli.AppContext{ | ||
Config: &config.AppConfig{ | ||
ConfigPath: tempFile, | ||
Port: 9999, | ||
}, | ||
Executor: map[string]executor.Executor{"": &mockExecutor{}}, | ||
} | ||
|
||
f := createRunCommand(appContext) | ||
ctx, cancelFunc := context.WithTimeout(context.Background(), 5*time.Second) | ||
defer cancelFunc() | ||
rootCmd := &cobra.Command{ | ||
Use: "root", | ||
RunE: f, | ||
} | ||
rootCmd.SetContext(ctx) | ||
err = f(rootCmd, []string{"bafybeibt4amyuwvxjgq6rynmchyplbu33nixl63sdcsm7g2nb2gt6vrixu"}) | ||
assert.NilError(t, err) | ||
} | ||
|
||
type mockExecutor struct{} | ||
|
||
func (*mockExecutor) Execute(context.Context, interface{}) (executor.Result, error) { | ||
return executor.Result{}, nil | ||
} | ||
|
||
func (*mockExecutor) Render(config.Job, []executor.ExecutorIOSpec, []executor.ExecutorIOSpec) (interface{}, error) { | ||
return "", nil | ||
} |
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