diff --git a/.circleci/config.yml b/.circleci/config.yml index 7e8f618..2262a36 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,6 +23,12 @@ jobs: command: | mkdir -p /tmp/test-reports gotestsum --junitfile /tmp/test-reports/unit-tests.xml + - run: + name: Run coverage + command: go test -race -coverprofile=coverage.out -covermode=atomic + - run: + name: Upload coverage to Codecov + command: bash <(curl -s https://codecov.io/bash) - store_test_results: path: /tmp/test-reports @@ -63,5 +69,6 @@ workflows: only: - master - deploy-with-circle + - test-deploy requires: - build diff --git a/main.go b/main.go index b7a0378..883a412 100644 --- a/main.go +++ b/main.go @@ -15,8 +15,8 @@ import ( //ProductionHosts should be configured to include all hosts the mobile can connect to var ProductionHosts Hosts = []Host{ - {name: "pacific", url: "https://pacific.withsempo.com"}, {name: "demo", url: "https://demo.withsempo.com"}, + {name: "pacific", url: "https://pacific.withsempo.com"}, {name: "celo", url: "https://celo.withsempo.com"}, {name: "png", url: "https://png.withsempo.com"}, {name: "dev", url: "https://dev.withsempo.com"}, @@ -56,6 +56,16 @@ func CheckForValidAuth(host Host, inputBody string) (json []byte, ok bool) { } defer resp.Body.Close() + fmt.Println("----") + fmt.Println("jsonStr") + fmt.Println(jsonStr) + fmt.Println("resp") + fmt.Println(resp) + fmt.Println("resp.Body") + fmt.Println(resp.Body) + fmt.Println("resp.StatusCode") + fmt.Println(resp.StatusCode) + fmt.Println("----") if !(resp.StatusCode >= 200 && resp.StatusCode <= 299) { return nil, false @@ -105,6 +115,7 @@ func HandleLambdaEvent( headers := make(map[string]string) headers["Access-Control-Allow-Origin"] = "*" + headers["TEST_HEADER"] = "*" headers["Access-Control-Allow-Headers"] = "Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token" // The WaitGroup will trigger the waitchannel if all host requests fail