Skip to content

Commit

Permalink
chore: move hello mutator to testutils
Browse files Browse the repository at this point in the history
  • Loading branch information
mxab committed Mar 7, 2023
1 parent 0b1745f commit d77196c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 32 deletions.
21 changes: 0 additions & 21 deletions admissionctrl/mutator/mutator_test.go

This file was deleted.

2 changes: 0 additions & 2 deletions nacp.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,6 @@ func createMutatators(c *config.Config, appLogger hclog.Logger) ([]admissionctrl
var jobMutators []admissionctrl.JobMutator
for _, m := range c.Mutators {
switch m.Type {
case "hello":
jobMutators = append(jobMutators, &mutator.HelloMutator{})

case "opa_jsonpatch":

Expand Down
9 changes: 4 additions & 5 deletions nacp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/hashicorp/nomad/api"
"github.com/hashicorp/nomad/helper"
"github.com/mxab/nacp/admissionctrl"
"github.com/mxab/nacp/admissionctrl/mutator"
"github.com/mxab/nacp/testutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
Expand Down Expand Up @@ -57,7 +56,7 @@ func TestProxy(t *testing.T) {
nomadResponse: toJson(t, &api.JobRegisterResponse{}),
validators: []admissionctrl.JobValidator{},
mutators: []admissionctrl.JobMutator{
&mutator.HelloMutator{},
&testutil.HelloMutator{},
},
},

Expand All @@ -78,7 +77,7 @@ func TestProxy(t *testing.T) {

validators: []admissionctrl.JobValidator{},
mutators: []admissionctrl.JobMutator{
&mutator.HelloMutator{},
&testutil.HelloMutator{},
},
},
{
Expand Down Expand Up @@ -161,7 +160,7 @@ func TestProxy(t *testing.T) {
nomadResponse: toJson(t, &api.JobValidateResponse{}),
validators: []admissionctrl.JobValidator{},
mutators: []admissionctrl.JobMutator{
&mutator.HelloMutator{},
&testutil.HelloMutator{},
},
},
{
Expand Down Expand Up @@ -285,7 +284,7 @@ func TestJobUpdateProxy(t *testing.T) {
nomadResponse: toJson(t, &api.JobRegisterResponse{}),
validators: []admissionctrl.JobValidator{},
mutators: []admissionctrl.JobMutator{
&mutator.HelloMutator{},
&testutil.HelloMutator{},
},
},
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package mutator
package testutil

import (
"github.com/hashicorp/nomad/api"
)
import "github.com/hashicorp/nomad/api"

type HelloMutator struct {
MutatorName string
Expand Down

0 comments on commit d77196c

Please sign in to comment.