Skip to content

Commit

Permalink
Remove cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
jesusfcr committed Dec 18, 2024
1 parent a668fdb commit 01f0170
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions internal/http/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ type httpTest struct {

type httpIntParams struct {
checkRunner CheckerHandleRun
checkCleaner func(resourceToClean interface{}, ctx context.Context, target, assetType, optJSON string)
resourceToClean interface{}
checkName string
config *config.Config
Expand Down Expand Up @@ -160,10 +159,6 @@ func TestIntegrationHttpMode(t *testing.T) {
},
},
resourceToClean: map[string]string{"key": "initial"},
checkCleaner: func(resource interface{}, ctx context.Context, target, assetType, opt string) {
r := resource.(map[string]string)
r["key"] = "cleaned"
},
},
wantResourceState: map[string]string{"key": "cleaned"},
want: map[string]agent.State{
Expand Down Expand Up @@ -230,14 +225,8 @@ func TestIntegrationHttpMode(t *testing.T) {
tt := tt
t.Run(tt.name, func(t2 *testing.T) {
conf := tt.args.config
var cleaner func(ctx context.Context, target, assetType, opts string)
if tt.args.checkCleaner != nil {
cleaner = func(ctx context.Context, target, assetType, opts string) {
tt.args.checkCleaner(tt.args.resourceToClean, ctx, target, assetType, opts)
}
}
l := logging.BuildRootLog("httpCheck")
c := NewCheckFromHandlerWithConfig(tt.args.checkName, tt.args.checkRunner, cleaner, conf, l)
c := NewCheckFromHandlerWithConfig(tt.args.checkName, tt.args.checkRunner, nil, conf, l)
go c.RunAndServe()
client := &http.Client{}
url := fmt.Sprintf("http://localhost:%d/run", *tt.args.config.Port)
Expand Down Expand Up @@ -330,12 +319,6 @@ func TestIntegrationHttpMode(t *testing.T) {
t.Errorf("Unable to unmarshal response: %v", err)
return
}

// Compare resource to clean up state with wanted state.
diff := cmp.Diff(tt.wantResourceState, tt.args.resourceToClean)
if diff != "" {
t.Errorf("Error want resource to clean state != got. Diff %s", diff)
}
n.resp = r
}(key, i, job)
}
Expand Down

0 comments on commit 01f0170

Please sign in to comment.