Skip to content

Commit

Permalink
tests: remove env check
Browse files Browse the repository at this point in the history
  • Loading branch information
karl-cardenas-coding committed Dec 28, 2024
1 parent 34d9ede commit 9233931
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)


<p align="center">
Expand Down
17 changes: 0 additions & 17 deletions cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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)
Expand All @@ -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)
}
}

0 comments on commit 9233931

Please sign in to comment.