Skip to content

Commit

Permalink
Improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Jan 14, 2025
1 parent 7bcb942 commit e75ff62
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions pkg/handlers/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,28 @@ func TestMakeDeleteHandler(t *testing.T) {
if hreq.URL.Path != "/input" && hreq.URL.Path != "/output" && !strings.HasPrefix(hreq.URL.Path, "/minio/admin/v3/") {
t.Errorf("Unexpected path in request, got: %s", hreq.URL.Path)
}
if hreq.URL.Path == "/minio/admin/v3/info" {
rw.WriteHeader(http.StatusOK)
rw.Write([]byte(`{"Mode": "local", "Region": "us-east-1"}`))
} else if hreq.URL.Path == "/minio/admin/v3/info-canned-policy" {
rw.WriteHeader(http.StatusOK)
rw.Write([]byte(`{
"PolicyName": "input",
"Policy": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["s3:GetObject"],
"Resource": ["arn:aws:s3:::example-bucket/*"]
}
]
}
}`))
} else {
rw.WriteHeader(http.StatusOK)
rw.Write([]byte(`{"status": "success"}`))
}
}))

// and set the MinIO endpoint to the fake server
Expand All @@ -41,6 +63,8 @@ func TestMakeDeleteHandler(t *testing.T) {
Output: []types.StorageIOConfig{
{Provider: "minio." + types.DefaultProvider, Path: "/output"},
},
IsolationLevel: "USER",
AllowedUsers: []string{"somelonguid1@egi.eu"},
StorageProviders: &types.StorageProviders{
MinIO: map[string]*types.MinIOProvider{types.DefaultProvider: {
Region: "us-east-1",
Expand Down

0 comments on commit e75ff62

Please sign in to comment.