From 9233931aa7920b738f150c46a563e862212274f4 Mon Sep 17 00:00:00 2001 From: Karl Cardenas Date: Sat, 28 Dec 2024 10:04:00 -0700 Subject: [PATCH] tests: remove env check --- Makefile | 2 +- README.md | 1 + cmd/root_test.go | 17 ----------------- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 233546d..4c792ea 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ build: ## Build the binary file tests: ## Run tests @echo "Running tests" - go test -race ./... + go test -shuffle on -race ./... tests-coverage: ## Start Go Test with code coverage diff --git a/README.md b/README.md index ef6d438..ee1f582 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![codecov](https://codecov.io/gh/karl-cardenas-coding/go-lambda-cleanup/graph/badge.svg?token=S8SY4ZA2ZA)](https://codecov.io/gh/karl-cardenas-coding/go-lambda-cleanup) [![Go Report Card](https://goreportcard.com/badge/github.com/karl-cardenas-coding/go-lambda-cleanup/v2)](https://goreportcard.com/report/github.com/karl-cardenas-coding/go-lambda-cleanup/v2) +[![Nighly Build](https://github.com/karl-cardenas-coding/go-lambda-clean-up/actions/workflows/nightly.yaml/badge.svg)](https://github.com/karl-cardenas-coding/go-lambda-cleanup/actions/workflows/nightly.yaml)

diff --git a/cmd/root_test.go b/cmd/root_test.go index cac296f..0dc4193 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -375,9 +375,6 @@ func TestNoLambdas(t *testing.T) { } func TestCreateHTTPClient(t *testing.T) { - // Set an environment variable for the proxy - os.Setenv("HTTP_PROXY", "http://proxy.example.com") - defer os.Unsetenv("HTTP_PROXY") client := createHTTPClient() @@ -392,10 +389,6 @@ func TestCreateHTTPClient(t *testing.T) { t.Fatalf("Expected transport to be of type *http.Transport, got %T", client.Transport) } - if transport != nil { - t.Fatalf("Expected non-nil transport") - } - // Check if the minimum TLS version is set to TLS 1.2 if transport.TLSClientConfig.MinVersion != tls.VersionTLS12 { t.Errorf("Expected MinVersion to be TLS 1.2, got %v", transport.TLSClientConfig.MinVersion) @@ -405,14 +398,4 @@ func TestCreateHTTPClient(t *testing.T) { if !transport.ForceAttemptHTTP2 { t.Errorf("Expected ForceAttemptHTTP2 to be true, got %v", transport.ForceAttemptHTTP2) } - - // Check if Proxy is set correctly from the environment - req, _ := http.NewRequest("GET", "http://example.com", nil) - proxyURL, err := transport.Proxy(req) - if err != nil { - t.Fatalf("Expected no error from Proxy function, got %v", err) - } - if proxyURL.String() != "http://proxy.example.com" { - t.Errorf("Expected proxy URL to be http://proxy.example.com, got %v", proxyURL) - } }