Skip to content

Commit 902044b

Browse files
committed
Rename action command to execute
1 parent e185a28 commit 902044b

File tree

7 files changed

+41
-141
lines changed

7 files changed

+41
-141
lines changed

.mockery.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ packages:
5858
dir: mocks/generated/run/actions/action/bench
5959
interfaces:
6060
Maker: {}
61-
github.com/wstool/wst/run/actions/action/command:
61+
github.com/wstool/wst/run/actions/action/execute:
6262
config:
63-
dir: mocks/generated/run/actions/action/command
63+
dir: mocks/generated/run/actions/action/execute
6464
interfaces:
6565
Maker: {}
6666
github.com/wstool/wst/run/actions/action/expect:

conf/types/action.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ type ArgsCommand struct {
9292

9393
type Command interface{}
9494

95-
type CommandAction struct {
95+
type ExecuteAction struct {
9696
Service string `wst:"service"`
9797
Timeout int `wst:"timeout"`
9898
When string `wst:"when,enum=always|on_success|on_fail,default=on_success"`

mocks/generated/run/actions/action/command/mock_Maker.go

Lines changed: 0 additions & 100 deletions
This file was deleted.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package command
1+
package execute
22

33
import (
44
"context"
@@ -16,7 +16,7 @@ import (
1616

1717
type Maker interface {
1818
Make(
19-
config *types.CommandAction,
19+
config *types.ExecuteAction,
2020
sl services.ServiceLocator,
2121
defaultTimeout int,
2222
) (action.Action, error)
@@ -35,7 +35,7 @@ func CreateActionMaker(fnd app.Foundation) *ActionMaker {
3535
}
3636

3737
func (m *ActionMaker) Make(
38-
config *types.CommandAction,
38+
config *types.ExecuteAction,
3939
sl services.ServiceLocator,
4040
defaultTimeout int,
4141
) (action.Action, error) {
@@ -126,7 +126,7 @@ func (a *Action) renderCommand() (*environment.Command, error) {
126126
}
127127

128128
func (a *Action) Execute(ctx context.Context, runData runtime.Data) (bool, error) {
129-
a.fnd.Logger().Infof("Executing command action")
129+
a.fnd.Logger().Infof("Executing execute action")
130130

131131
// Send the request.
132132
oc := a.outputMaker.MakeCollector(fmt.Sprintf("action %s", a.id))

run/actions/action/command/command_test.go renamed to run/actions/action/execute/execute_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package command
1+
package execute
22

33
import (
44
"context"
@@ -43,7 +43,7 @@ func TestCreateActionMaker(t *testing.T) {
4343
func TestActionMaker_Make(t *testing.T) {
4444
tests := []struct {
4545
name string
46-
config *types.CommandAction
46+
config *types.ExecuteAction
4747
defaultTimeout int
4848
setupMocks func(*testing.T, *servicesMocks.MockServiceLocator) services.Service
4949
getExpectedAction func(*appMocks.MockFoundation, services.Service, output.Maker) *Action
@@ -52,7 +52,7 @@ func TestActionMaker_Make(t *testing.T) {
5252
}{
5353
{
5454
name: "successful shell command creation with default timeout",
55-
config: &types.CommandAction{
55+
config: &types.ExecuteAction{
5656
Service: "validService",
5757
Shell: "/bin/bash",
5858
Command: &types.ShellCommand{
@@ -86,7 +86,7 @@ func TestActionMaker_Make(t *testing.T) {
8686
},
8787
{
8888
name: "successful args command creation with config timeout",
89-
config: &types.CommandAction{
89+
config: &types.ExecuteAction{
9090
Service: "validService",
9191
Command: &types.ArgsCommand{
9292
Args: []string{"ls", "-la"},
@@ -119,7 +119,7 @@ func TestActionMaker_Make(t *testing.T) {
119119
},
120120
{
121121
name: "failure - service not found",
122-
config: &types.CommandAction{
122+
config: &types.ExecuteAction{
123123
Service: "invalidService",
124124
Command: &types.ArgsCommand{
125125
Args: []string{"ls"},
@@ -135,7 +135,7 @@ func TestActionMaker_Make(t *testing.T) {
135135
},
136136
{
137137
name: "failure - empty args command",
138-
config: &types.CommandAction{
138+
config: &types.ExecuteAction{
139139
Service: "validService",
140140
Command: &types.ArgsCommand{
141141
Args: []string{},
@@ -152,7 +152,7 @@ func TestActionMaker_Make(t *testing.T) {
152152
},
153153
{
154154
name: "failure - unsupported command type",
155-
config: &types.CommandAction{
155+
config: &types.ExecuteAction{
156156
Service: "validService",
157157
Command: &struct{}{}, // some arbitrary struct that doesn't implement known command types
158158
},

run/actions/actions.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"github.com/wstool/wst/conf/types"
2121
"github.com/wstool/wst/run/actions/action"
2222
"github.com/wstool/wst/run/actions/action/bench"
23-
"github.com/wstool/wst/run/actions/action/command"
23+
"github.com/wstool/wst/run/actions/action/execute"
2424
"github.com/wstool/wst/run/actions/action/expect"
2525
"github.com/wstool/wst/run/actions/action/not"
2626
"github.com/wstool/wst/run/actions/action/parallel"
@@ -44,7 +44,7 @@ type nativeActionMaker struct {
4444
fnd app.Foundation
4545
runtimeMaker runtime.Maker
4646
benchMaker bench.Maker
47-
commandMaker command.Maker
47+
executeMaker execute.Maker
4848
expectMaker expect.Maker
4949
notMaker not.Maker
5050
parallelMaker parallel.Maker
@@ -66,7 +66,7 @@ func CreateActionMaker(
6666
fnd: fnd,
6767
runtimeMaker: runtimeMaker,
6868
benchMaker: bench.CreateActionMaker(fnd),
69-
commandMaker: command.CreateActionMaker(fnd),
69+
executeMaker: execute.CreateActionMaker(fnd),
7070
expectMaker: expect.CreateExpectationActionMaker(fnd, expectationsMaker, parametersMaker),
7171
notMaker: not.CreateActionMaker(fnd, runtimeMaker),
7272
parallelMaker: parallel.CreateActionMaker(fnd, runtimeMaker),
@@ -87,8 +87,8 @@ func (m *nativeActionMaker) MakeAction(
8787
switch action := config.(type) {
8888
case *types.BenchAction:
8989
return m.benchMaker.Make(action, sl, defaultTimeout)
90-
case *types.CommandAction:
91-
return m.commandMaker.Make(action, sl, defaultTimeout)
90+
case *types.ExecuteAction:
91+
return m.executeMaker.Make(action, sl, defaultTimeout)
9292
case *types.CustomExpectationAction:
9393
return m.expectMaker.MakeCustomAction(action, sl, defaultTimeout)
9494
case *types.MetricsExpectationAction:

0 commit comments

Comments
 (0)