From 2ab30900d4a15c583d673fbe9da32070df8a204c Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 15 Feb 2026 18:13:40 -0800 Subject: [PATCH] test(volume_server/http): add mkcol unsupported-method parity --- .../http/public_cors_methods_test.go | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/test/volume_server/http/public_cors_methods_test.go b/test/volume_server/http/public_cors_methods_test.go index 5328b9a8b..a27a8858a 100644 --- a/test/volume_server/http/public_cors_methods_test.go +++ b/test/volume_server/http/public_cors_methods_test.go @@ -251,6 +251,50 @@ func TestUnsupportedMethodConnectParity(t *testing.T) { } } +func TestUnsupportedMethodMkcolParity(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test in short mode") + } + + clusterHarness := framework.StartSingleVolumeCluster(t, matrix.P2()) + conn, grpcClient := framework.DialVolumeServer(t, clusterHarness.VolumeGRPCAddress()) + defer conn.Close() + + const volumeID = uint32(88) + framework.AllocateVolume(t, grpcClient, volumeID, "") + + fid := framework.NewFileID(volumeID, 124004, 0x06060606) + client := framework.NewHTTPClient() + uploadResp := framework.UploadBytes(t, client, clusterHarness.VolumeAdminURL(), fid, []byte("mkcol-method-check")) + _ = framework.ReadAllAndClose(t, uploadResp) + if uploadResp.StatusCode != http.StatusCreated { + t.Fatalf("upload expected 201, got %d", uploadResp.StatusCode) + } + + adminReq := mustNewRequest(t, "MKCOL", clusterHarness.VolumeAdminURL()+"/"+fid) + adminResp := framework.DoRequest(t, client, adminReq) + _ = framework.ReadAllAndClose(t, adminResp) + if adminResp.StatusCode != http.StatusBadRequest { + t.Fatalf("admin MKCOL expected 400, got %d", adminResp.StatusCode) + } + + publicReq := mustNewRequest(t, "MKCOL", clusterHarness.VolumePublicURL()+"/"+fid) + publicResp := framework.DoRequest(t, client, publicReq) + _ = framework.ReadAllAndClose(t, publicResp) + if publicResp.StatusCode != http.StatusOK { + t.Fatalf("public MKCOL expected passthrough 200, got %d", publicResp.StatusCode) + } + + verifyResp := framework.ReadBytes(t, client, clusterHarness.VolumeAdminURL(), fid) + verifyBody := framework.ReadAllAndClose(t, verifyResp) + if verifyResp.StatusCode != http.StatusOK { + t.Fatalf("verify GET expected 200, got %d", verifyResp.StatusCode) + } + if string(verifyBody) != "mkcol-method-check" { + t.Fatalf("MKCOL should not mutate data, got %q", string(verifyBody)) + } +} + func TestPublicPortHeadReadParity(t *testing.T) { if testing.Short() { t.Skip("skipping integration test in short mode")