diff --git a/test/s3/acl/s3_test_main.go b/test/s3/acl/s3_test_main.go new file mode 100644 index 000000000..27c0a004f --- /dev/null +++ b/test/s3/acl/s3_test_main.go @@ -0,0 +1,42 @@ +package acl + +import ( +"fmt" +"os" +"testing" + +"github.com/seaweedfs/seaweedfs/test/s3/testutil" +) + +var testServer *testutil.TestServer + +// TestMain sets up and tears down the test environment using weed mini +func TestMain(m *testing.M) { + var exitCode int + + fmt.Println("TestMain: Starting test setup...") + + // Check if we should manage the server or use an existing one + if os.Getenv("USE_EXTERNAL_SERVER") != "true" { + // Start server using weed mini + fmt.Println("TestMain: Starting weed mini server...") + config := testutil.DefaultServerConfig(nil) + config.AccessKey = "some_access_key1" + config.SecretKey = "some_secret_key1" + + var err error + testServer, err = testutil.StartServer(config) + if err != nil { + fmt.Printf("TestMain: ERROR - Failed to start test server: %v\n", err) + os.Exit(1) + } + fmt.Println("TestMain: Server started successfully") + defer testServer.Stop() + } + + // Run tests + fmt.Println("TestMain: Running tests...") + exitCode = m.Run() + fmt.Printf("TestMain: Tests completed with exit code %d\n", exitCode) + os.Exit(exitCode) +} diff --git a/test/s3/basic/s3_test_main.go b/test/s3/basic/s3_test_main.go new file mode 100644 index 000000000..e99f033d6 --- /dev/null +++ b/test/s3/basic/s3_test_main.go @@ -0,0 +1,42 @@ +package basic + +import ( +"fmt" +"os" +"testing" + +"github.com/seaweedfs/seaweedfs/test/s3/testutil" +) + +var testServer *testutil.TestServer + +// TestMain sets up and tears down the test environment using weed mini +func TestMain(m *testing.M) { + var exitCode int + + fmt.Println("TestMain: Starting test setup...") + + // Check if we should manage the server or use an existing one + if os.Getenv("USE_EXTERNAL_SERVER") != "true" { + // Start server using weed mini + fmt.Println("TestMain: Starting weed mini server...") + config := testutil.DefaultServerConfig(nil) + config.AccessKey = "some_access_key1" + config.SecretKey = "some_secret_key1" + + var err error + testServer, err = testutil.StartServer(config) + if err != nil { + fmt.Printf("TestMain: ERROR - Failed to start test server: %v\n", err) + os.Exit(1) + } + fmt.Println("TestMain: Server started successfully") + defer testServer.Stop() + } + + // Run tests + fmt.Println("TestMain: Running tests...") + exitCode = m.Run() + fmt.Printf("TestMain: Tests completed with exit code %d\n", exitCode) + os.Exit(exitCode) +} diff --git a/test/s3/copying/s3_test_main.go b/test/s3/copying/s3_test_main.go new file mode 100644 index 000000000..73cee5528 --- /dev/null +++ b/test/s3/copying/s3_test_main.go @@ -0,0 +1,42 @@ +package copying_test + +import ( +"fmt" +"os" +"testing" + +"github.com/seaweedfs/seaweedfs/test/s3/testutil" +) + +var testServer *testutil.TestServer + +// TestMain sets up and tears down the test environment using weed mini +func TestMain(m *testing.M) { + var exitCode int + + fmt.Println("TestMain: Starting test setup...") + + // Check if we should manage the server or use an existing one + if os.Getenv("USE_EXTERNAL_SERVER") != "true" { + // Start server using weed mini + fmt.Println("TestMain: Starting weed mini server...") + config := testutil.DefaultServerConfig(nil) + config.AccessKey = "some_access_key1" + config.SecretKey = "some_secret_key1" + + var err error + testServer, err = testutil.StartServer(config) + if err != nil { + fmt.Printf("TestMain: ERROR - Failed to start test server: %v\n", err) + os.Exit(1) + } + fmt.Println("TestMain: Server started successfully") + defer testServer.Stop() + } + + // Run tests + fmt.Println("TestMain: Running tests...") + exitCode = m.Run() + fmt.Printf("TestMain: Tests completed with exit code %d\n", exitCode) + os.Exit(exitCode) +} diff --git a/test/s3/cors/s3_test_main.go b/test/s3/cors/s3_test_main.go new file mode 100644 index 000000000..2d385211f --- /dev/null +++ b/test/s3/cors/s3_test_main.go @@ -0,0 +1,42 @@ +package cors + +import ( +"fmt" +"os" +"testing" + +"github.com/seaweedfs/seaweedfs/test/s3/testutil" +) + +var testServer *testutil.TestServer + +// TestMain sets up and tears down the test environment using weed mini +func TestMain(m *testing.M) { + var exitCode int + + fmt.Println("TestMain: Starting test setup...") + + // Check if we should manage the server or use an existing one + if os.Getenv("USE_EXTERNAL_SERVER") != "true" { + // Start server using weed mini + fmt.Println("TestMain: Starting weed mini server...") + config := testutil.DefaultServerConfig(nil) + config.AccessKey = "some_access_key1" + config.SecretKey = "some_secret_key1" + + var err error + testServer, err = testutil.StartServer(config) + if err != nil { + fmt.Printf("TestMain: ERROR - Failed to start test server: %v\n", err) + os.Exit(1) + } + fmt.Println("TestMain: Server started successfully") + defer testServer.Stop() + } + + // Run tests + fmt.Println("TestMain: Running tests...") + exitCode = m.Run() + fmt.Printf("TestMain: Tests completed with exit code %d\n", exitCode) + os.Exit(exitCode) +} diff --git a/test/s3/delete/s3_test_main.go b/test/s3/delete/s3_test_main.go new file mode 100644 index 000000000..60c641aea --- /dev/null +++ b/test/s3/delete/s3_test_main.go @@ -0,0 +1,42 @@ +package delete + +import ( +"fmt" +"os" +"testing" + +"github.com/seaweedfs/seaweedfs/test/s3/testutil" +) + +var testServer *testutil.TestServer + +// TestMain sets up and tears down the test environment using weed mini +func TestMain(m *testing.M) { + var exitCode int + + fmt.Println("TestMain: Starting test setup...") + + // Check if we should manage the server or use an existing one + if os.Getenv("USE_EXTERNAL_SERVER") != "true" { + // Start server using weed mini + fmt.Println("TestMain: Starting weed mini server...") + config := testutil.DefaultServerConfig(nil) + config.AccessKey = "some_access_key1" + config.SecretKey = "some_secret_key1" + + var err error + testServer, err = testutil.StartServer(config) + if err != nil { + fmt.Printf("TestMain: ERROR - Failed to start test server: %v\n", err) + os.Exit(1) + } + fmt.Println("TestMain: Server started successfully") + defer testServer.Stop() + } + + // Run tests + fmt.Println("TestMain: Running tests...") + exitCode = m.Run() + fmt.Printf("TestMain: Tests completed with exit code %d\n", exitCode) + os.Exit(exitCode) +} diff --git a/test/s3/etag/s3_test_main.go b/test/s3/etag/s3_test_main.go new file mode 100644 index 000000000..6fcf7aae7 --- /dev/null +++ b/test/s3/etag/s3_test_main.go @@ -0,0 +1,42 @@ +package s3api + +import ( +"fmt" +"os" +"testing" + +"github.com/seaweedfs/seaweedfs/test/s3/testutil" +) + +var testServer *testutil.TestServer + +// TestMain sets up and tears down the test environment using weed mini +func TestMain(m *testing.M) { + var exitCode int + + fmt.Println("TestMain: Starting test setup...") + + // Check if we should manage the server or use an existing one + if os.Getenv("USE_EXTERNAL_SERVER") != "true" { + // Start server using weed mini + fmt.Println("TestMain: Starting weed mini server...") + config := testutil.DefaultServerConfig(nil) + config.AccessKey = "some_access_key1" + config.SecretKey = "some_secret_key1" + + var err error + testServer, err = testutil.StartServer(config) + if err != nil { + fmt.Printf("TestMain: ERROR - Failed to start test server: %v\n", err) + os.Exit(1) + } + fmt.Println("TestMain: Server started successfully") + defer testServer.Stop() + } + + // Run tests + fmt.Println("TestMain: Running tests...") + exitCode = m.Run() + fmt.Printf("TestMain: Tests completed with exit code %d\n", exitCode) + os.Exit(exitCode) +} diff --git a/test/s3/filer_group/s3_test_main.go b/test/s3/filer_group/s3_test_main.go new file mode 100644 index 000000000..8089c5e5c --- /dev/null +++ b/test/s3/filer_group/s3_test_main.go @@ -0,0 +1,42 @@ +package filer_group + +import ( +"fmt" +"os" +"testing" + +"github.com/seaweedfs/seaweedfs/test/s3/testutil" +) + +var testServer *testutil.TestServer + +// TestMain sets up and tears down the test environment using weed mini +func TestMain(m *testing.M) { + var exitCode int + + fmt.Println("TestMain: Starting test setup...") + + // Check if we should manage the server or use an existing one + if os.Getenv("USE_EXTERNAL_SERVER") != "true" { + // Start server using weed mini + fmt.Println("TestMain: Starting weed mini server...") + config := testutil.DefaultServerConfig(nil) + config.AccessKey = "some_access_key1" + config.SecretKey = "some_secret_key1" + + var err error + testServer, err = testutil.StartServer(config) + if err != nil { + fmt.Printf("TestMain: ERROR - Failed to start test server: %v\n", err) + os.Exit(1) + } + fmt.Println("TestMain: Server started successfully") + defer testServer.Stop() + } + + // Run tests + fmt.Println("TestMain: Running tests...") + exitCode = m.Run() + fmt.Printf("TestMain: Tests completed with exit code %d\n", exitCode) + os.Exit(exitCode) +} diff --git a/test/s3/iam/s3_test_main.go b/test/s3/iam/s3_test_main.go new file mode 100644 index 000000000..302591677 --- /dev/null +++ b/test/s3/iam/s3_test_main.go @@ -0,0 +1,42 @@ +package iam + +import ( +"fmt" +"os" +"testing" + +"github.com/seaweedfs/seaweedfs/test/s3/testutil" +) + +var testServer *testutil.TestServer + +// TestMain sets up and tears down the test environment using weed mini +func TestMain(m *testing.M) { + var exitCode int + + fmt.Println("TestMain: Starting test setup...") + + // Check if we should manage the server or use an existing one + if os.Getenv("USE_EXTERNAL_SERVER") != "true" { + // Start server using weed mini + fmt.Println("TestMain: Starting weed mini server...") + config := testutil.DefaultServerConfig(nil) + config.AccessKey = "some_access_key1" + config.SecretKey = "some_secret_key1" + + var err error + testServer, err = testutil.StartServer(config) + if err != nil { + fmt.Printf("TestMain: ERROR - Failed to start test server: %v\n", err) + os.Exit(1) + } + fmt.Println("TestMain: Server started successfully") + defer testServer.Stop() + } + + // Run tests + fmt.Println("TestMain: Running tests...") + exitCode = m.Run() + fmt.Printf("TestMain: Tests completed with exit code %d\n", exitCode) + os.Exit(exitCode) +} diff --git a/test/s3/remote_cache/s3_test_main.go b/test/s3/remote_cache/s3_test_main.go new file mode 100644 index 000000000..006e690df --- /dev/null +++ b/test/s3/remote_cache/s3_test_main.go @@ -0,0 +1,42 @@ +package remote_cache + +import ( +"fmt" +"os" +"testing" + +"github.com/seaweedfs/seaweedfs/test/s3/testutil" +) + +var testServer *testutil.TestServer + +// TestMain sets up and tears down the test environment using weed mini +func TestMain(m *testing.M) { + var exitCode int + + fmt.Println("TestMain: Starting test setup...") + + // Check if we should manage the server or use an existing one + if os.Getenv("USE_EXTERNAL_SERVER") != "true" { + // Start server using weed mini + fmt.Println("TestMain: Starting weed mini server...") + config := testutil.DefaultServerConfig(nil) + config.AccessKey = "some_access_key1" + config.SecretKey = "some_secret_key1" + + var err error + testServer, err = testutil.StartServer(config) + if err != nil { + fmt.Printf("TestMain: ERROR - Failed to start test server: %v\n", err) + os.Exit(1) + } + fmt.Println("TestMain: Server started successfully") + defer testServer.Stop() + } + + // Run tests + fmt.Println("TestMain: Running tests...") + exitCode = m.Run() + fmt.Printf("TestMain: Tests completed with exit code %d\n", exitCode) + os.Exit(exitCode) +} diff --git a/test/s3/retention/s3_test_main.go b/test/s3/retention/s3_test_main.go new file mode 100644 index 000000000..a24e3427f --- /dev/null +++ b/test/s3/retention/s3_test_main.go @@ -0,0 +1,42 @@ +package retention + +import ( +"fmt" +"os" +"testing" + +"github.com/seaweedfs/seaweedfs/test/s3/testutil" +) + +var testServer *testutil.TestServer + +// TestMain sets up and tears down the test environment using weed mini +func TestMain(m *testing.M) { + var exitCode int + + fmt.Println("TestMain: Starting test setup...") + + // Check if we should manage the server or use an existing one + if os.Getenv("USE_EXTERNAL_SERVER") != "true" { + // Start server using weed mini + fmt.Println("TestMain: Starting weed mini server...") + config := testutil.DefaultServerConfig(nil) + config.AccessKey = "some_access_key1" + config.SecretKey = "some_secret_key1" + + var err error + testServer, err = testutil.StartServer(config) + if err != nil { + fmt.Printf("TestMain: ERROR - Failed to start test server: %v\n", err) + os.Exit(1) + } + fmt.Println("TestMain: Server started successfully") + defer testServer.Stop() + } + + // Run tests + fmt.Println("TestMain: Running tests...") + exitCode = m.Run() + fmt.Printf("TestMain: Tests completed with exit code %d\n", exitCode) + os.Exit(exitCode) +} diff --git a/test/s3/sse/s3_test_main.go b/test/s3/sse/s3_test_main.go new file mode 100644 index 000000000..89e35dd82 --- /dev/null +++ b/test/s3/sse/s3_test_main.go @@ -0,0 +1,42 @@ +package sse_test + +import ( +"fmt" +"os" +"testing" + +"github.com/seaweedfs/seaweedfs/test/s3/testutil" +) + +var testServer *testutil.TestServer + +// TestMain sets up and tears down the test environment using weed mini +func TestMain(m *testing.M) { + var exitCode int + + fmt.Println("TestMain: Starting test setup...") + + // Check if we should manage the server or use an existing one + if os.Getenv("USE_EXTERNAL_SERVER") != "true" { + // Start server using weed mini + fmt.Println("TestMain: Starting weed mini server...") + config := testutil.DefaultServerConfig(nil) + config.AccessKey = "some_access_key1" + config.SecretKey = "some_secret_key1" + + var err error + testServer, err = testutil.StartServer(config) + if err != nil { + fmt.Printf("TestMain: ERROR - Failed to start test server: %v\n", err) + os.Exit(1) + } + fmt.Println("TestMain: Server started successfully") + defer testServer.Stop() + } + + // Run tests + fmt.Println("TestMain: Running tests...") + exitCode = m.Run() + fmt.Printf("TestMain: Tests completed with exit code %d\n", exitCode) + os.Exit(exitCode) +} diff --git a/test/s3/tagging/s3_test_main.go b/test/s3/tagging/s3_test_main.go new file mode 100644 index 000000000..387aa1278 --- /dev/null +++ b/test/s3/tagging/s3_test_main.go @@ -0,0 +1,42 @@ +package tagging + +import ( +"fmt" +"os" +"testing" + +"github.com/seaweedfs/seaweedfs/test/s3/testutil" +) + +var testServer *testutil.TestServer + +// TestMain sets up and tears down the test environment using weed mini +func TestMain(m *testing.M) { + var exitCode int + + fmt.Println("TestMain: Starting test setup...") + + // Check if we should manage the server or use an existing one + if os.Getenv("USE_EXTERNAL_SERVER") != "true" { + // Start server using weed mini + fmt.Println("TestMain: Starting weed mini server...") + config := testutil.DefaultServerConfig(nil) + config.AccessKey = "some_access_key1" + config.SecretKey = "some_secret_key1" + + var err error + testServer, err = testutil.StartServer(config) + if err != nil { + fmt.Printf("TestMain: ERROR - Failed to start test server: %v\n", err) + os.Exit(1) + } + fmt.Println("TestMain: Server started successfully") + defer testServer.Stop() + } + + // Run tests + fmt.Println("TestMain: Running tests...") + exitCode = m.Run() + fmt.Printf("TestMain: Tests completed with exit code %d\n", exitCode) + os.Exit(exitCode) +}