This commit is contained in:
2025-09-30 00:36:46 +01:00
parent 240929a808
commit 013dfa99fd
11 changed files with 387 additions and 56 deletions
+18 -2
View File
@@ -2,6 +2,7 @@ package gql
import (
"net/http/httptest"
"os"
"testing"
assertions "github.com/stretchr/testify/assert"
@@ -13,11 +14,19 @@ type Tests struct {
}
var (
assert *assertions.Assertions
mockServer *httptest.Server
assert *assertions.Assertions
mockServer *httptest.Server
originalInsecureSkipValue string
)
func (suite *Tests) SetupSuite() {
// Save original environment variable value
originalInsecureSkipValue = os.Getenv("GRAPHQL_INSECURE_SKIP_VERIFY")
// Set environment variable to skip TLS verification for test mock server
// The mock server uses self-signed certificates
os.Setenv("GRAPHQL_INSECURE_SKIP_VERIFY", "true")
// Start mock GraphQL server
mockServer = StartMockServer()
}
@@ -30,6 +39,13 @@ func (suite *Tests) TearDownSuite() {
// Cleanup shared test cache
CleanupTestCache()
// Restore original environment variable value
if originalInsecureSkipValue != "" {
os.Setenv("GRAPHQL_INSECURE_SKIP_VERIFY", originalInsecureSkipValue)
} else {
os.Unsetenv("GRAPHQL_INSECURE_SKIP_VERIFY")
}
}
func (suite *Tests) SetupTest() {