Skip to content

Commit

Permalink
refactor deployer discriminator to deployer_id
Browse files Browse the repository at this point in the history
  • Loading branch information
mfleader committed Oct 27, 2023
1 parent 2e8b44d commit 0660e38
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
16 changes: 8 additions & 8 deletions config/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ var configLoadData = map[string]struct {
expectedOutput: &config.Config{
TypeHintPlugins: nil,
LocalDeployers: config.LocalDeployers{
Image: map[string]string{"type": "docker"},
Python: map[string]string{"type": "python"},
Image: map[string]string{"deployer_id": "docker"},
Python: map[string]string{"deployer_id": "python"},
},
Log: log.Config{
Level: log.LevelInfo,
Expand All @@ -36,8 +36,8 @@ log:
expectedOutput: &config.Config{
TypeHintPlugins: nil,
LocalDeployers: config.LocalDeployers{
Image: map[string]string{"type": "docker"},
Python: map[string]string{"type": "python"},
Image: map[string]string{"deployer_id": "docker"},
Python: map[string]string{"deployer_id": "python"},
},
Log: log.Config{
Level: log.LevelDebug,
Expand All @@ -54,8 +54,8 @@ deployers:
expectedOutput: &config.Config{
TypeHintPlugins: nil,
LocalDeployers: config.LocalDeployers{
Image: map[string]string{"type": "kubernetes"},
Python: map[string]string{"type": "python"},
Image: map[string]string{"deployer_id": "kubernetes"},
Python: map[string]string{"deployer_id": "python"},
},
Log: log.Config{
Level: log.LevelInfo,
Expand All @@ -73,8 +73,8 @@ plugins:
"quay.io/arcalot/example-plugin:latest",
},
LocalDeployers: config.LocalDeployers{
Image: map[string]string{"type": "docker"},
Python: map[string]string{"type": "python"},
Image: map[string]string{"deployer_id": "docker"},
Python: map[string]string{"deployer_id": "python"},
},
Log: log.Config{
Level: log.LevelInfo,
Expand Down
2 changes: 1 addition & 1 deletion internal/step/plugin/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (p *pluginProvider) ProviderSchema() map[string]*schema.PropertySchema {
nil,
[]string{"\"quay.io/arcaflow/example-plugin:latest\""},
),
"type": schema.NewPropertySchema(
"deployer_id": schema.NewPropertySchema(
schema.NewStringSchema(schema.PointerTo[int64](1), nil, nil),
schema.NewDisplayValue(
schema.PointerTo("Type"),
Expand Down
28 changes: 14 additions & 14 deletions internal/step/plugin/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ func TestProvider_MultipleDeployers(t *testing.T) {
deployTimeMs := 20
workflowDeployerCfg := map[string]any{
"image": map[string]any{
"type": "test-impl",
"deployer_id": "test-impl",
"deploy_time": deployTimeMs,
"deploy_succeed": true,
},
"python": map[string]any{
"type": "test-impl",
"deployer_id": "test-impl",
},
}

Expand All @@ -144,8 +144,8 @@ func TestProvider_MultipleDeployers(t *testing.T) {

stepSchema := map[string]any{
"plugin": map[string]string{
"src": "simulation",
"type": "image",
"src": "simulation",
"deployer_id": "image",
},
}
byteSchema := map[string][]byte{}
Expand All @@ -168,7 +168,7 @@ func TestProvider_MultipleDeployers(t *testing.T) {

func TestProvider_Utility(t *testing.T) {
workflowDeployerCfg := map[string]any{
"image": map[string]any{"type": "test-impl"},
"image": map[string]any{"deployer_id": "test-impl"},
}

plp, err := plugin.New(
Expand Down Expand Up @@ -220,7 +220,7 @@ func TestProvider_HappyError(t *testing.T) {
},
)
workflowDeployerCfg := map[string]any{
"image": map[string]any{"type": "test-impl"},
"image": map[string]any{"deployer_id": "test-impl"},
}

deployerRegistry := deployer_registry.New(
Expand Down Expand Up @@ -270,22 +270,22 @@ func TestProvider_HappyError(t *testing.T) {
assert.Error(t, running.ProvideStageInput(
string(plugin.StageIDDeploy),
map[string]any{"deploy": map[string]any{
"type": "test-impl",
"deployer_id": "test-impl",
"deploy_time": "abc"}},
))

assert.NoError(t, running.ProvideStageInput(
string(plugin.StageIDDeploy),
map[string]any{"deploy": map[string]any{
"type": "test-impl",
"deployer_id": "test-impl",
"deploy_time": 1}},
))

// provide deploy input a 2nd time
assert.Error(t, running.ProvideStageInput(
string(plugin.StageIDDeploy),
map[string]any{"deploy": map[string]any{
"type": "test-impl",
"deployer_id": "test-impl",
"deploy_time": nil}},
))

Expand Down Expand Up @@ -336,7 +336,7 @@ func TestProvider_VerifyCancelSignal(t *testing.T) {
},
)
workflowDeployerCfg := map[string]any{
"type": "test-impl",
"deployer_id": "test-impl",
}

deployerRegistry := deployer_registry.New(
Expand Down Expand Up @@ -392,13 +392,13 @@ func TestProvider_DeployFail(t *testing.T) {
deployer.Any(testdeployer.NewFactory()))
deployTimeMs := 20
workflowDeployerCfg := map[string]any{
"image": map[string]any{"type": "test-impl"},
"image": map[string]any{"deployer_id": "test-impl"},
"deploy_time": deployTimeMs,
"deploy_succeed": true,
}

_ := map[string]any{

Check failure on line 400 in internal/step/plugin/provider_test.go

View workflow job for this annotation

GitHub Actions / go test

no new variables on left side of :=
"type": "test-impl",
"deployer_id": "test-impl",
"deploy_time": deployTimeMs,
"deploy_succeed": true,
}
Expand Down Expand Up @@ -474,7 +474,7 @@ func TestProvider_StartFail(t *testing.T) {
// "deploy_succeed": true,
//}
workflowDeployerCfg := map[string]any{
"image": map[string]any{"type": "test-impl"},
"image": map[string]any{"deployer_id": "test-impl"},
//"deploy_time": deployTimeMs,
//"deploy_succeed": true,
}
Expand Down Expand Up @@ -508,7 +508,7 @@ func TestProvider_StartFail(t *testing.T) {
assert.NoError(t, running.ProvideStageInput(
string(plugin.StageIDDeploy),
map[string]any{"deploy": map[string]any{
"type": "test-impl",
"deployer_id": "test-impl",
"deploy_succeed": true,
"deploy_time": deployTimeMs,
"disable_plugin_writes": true}},
Expand Down
2 changes: 1 addition & 1 deletion workflow/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func NewTestImplStepRegistry(

pluginProvider := assert.NoErrorR[step.Provider](t)(
plugin.New(logger, deployerRegistry, map[string]interface{}{
"type": "test-impl",
"deployer_id": "test-impl",
"deploy_time": "0",
}),
)
Expand Down

0 comments on commit 0660e38

Please sign in to comment.