From 5a1e5a5bd27d401e4f463d272214a44480e9bab3 Mon Sep 17 00:00:00 2001 From: michielderoos Date: Tue, 20 Jul 2021 14:40:48 -0300 Subject: [PATCH 1/8] codecov --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7e8f618..2f95d5c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,7 +22,7 @@ jobs: name: Run tests command: | mkdir -p /tmp/test-reports - gotestsum --junitfile /tmp/test-reports/unit-tests.xml + gotestsum --junitfile /tmp/test-reports/unit-tests.xml -race -coverprofile=coverage.out -covermode=atomic - store_test_results: path: /tmp/test-reports From ae383c21366d5903189cb501a3738c61c7277674 Mon Sep 17 00:00:00 2001 From: michielderoos Date: Tue, 20 Jul 2021 14:42:08 -0300 Subject: [PATCH 2/8] cov --- .circleci/config.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2f95d5c..d8041ab 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,7 +22,11 @@ jobs: name: Run tests command: | mkdir -p /tmp/test-reports - gotestsum --junitfile /tmp/test-reports/unit-tests.xml -race -coverprofile=coverage.out -covermode=atomic + gotestsum --junitfile /tmp/test-reports/unit-tests.xml + - run: + name: Run coverage + command: go test -race -coverprofile=coverage.out -covermode=atomic + - store_test_results: path: /tmp/test-reports From 5aaf709c7e21485e4b338b33886c172ab20d0d05 Mon Sep 17 00:00:00 2001 From: michielderoos Date: Tue, 20 Jul 2021 14:44:35 -0300 Subject: [PATCH 3/8] Upload to codecov --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index d8041ab..f982b82 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -55,6 +55,9 @@ jobs: - run: name: Updating GoDelegate command: aws lambda update-function-code --function-name GoDelegate --zip-file fileb://./godelegate.zip --region ap-southeast-2 + - run: + name: Upload coverage to Codecov + command: bash <(curl -s https://codecov.io/bash) workflows: version: 2 From 6cf3c5a544513f09f2630d85a0cba5d52d3bbc5d Mon Sep 17 00:00:00 2001 From: michielderoos Date: Tue, 20 Jul 2021 14:52:37 -0300 Subject: [PATCH 4/8] Move upload --- .circleci/config.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f982b82..4fa447b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,7 +26,9 @@ jobs: - 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 @@ -55,9 +57,6 @@ jobs: - run: name: Updating GoDelegate command: aws lambda update-function-code --function-name GoDelegate --zip-file fileb://./godelegate.zip --region ap-southeast-2 - - run: - name: Upload coverage to Codecov - command: bash <(curl -s https://codecov.io/bash) workflows: version: 2 From 84e3b88719c83bd77eb20658983e1565bfd9e6c1 Mon Sep 17 00:00:00 2001 From: michielderoos Date: Wed, 21 Jul 2021 14:28:43 -0300 Subject: [PATCH 5/8] Test --- .circleci/config.yml | 1 + main.go | 1 + 2 files changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4fa447b..96cf780 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -71,3 +71,4 @@ workflows: - deploy-with-circle requires: - build + - test_deploy diff --git a/main.go b/main.go index b7a0378..36e91cd 100644 --- a/main.go +++ b/main.go @@ -105,6 +105,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 From a8322c2736b8fc7d2b27db67335cc42b7b8fe80f Mon Sep 17 00:00:00 2001 From: michielderoos Date: Wed, 21 Jul 2021 14:34:23 -0300 Subject: [PATCH 6/8] beep --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 96cf780..47d20b4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -69,6 +69,6 @@ workflows: only: - master - deploy-with-circle + - test_deploy requires: - build - - test_deploy From e132a4341a04fcd3a404adfe7333228d4f6c084d Mon Sep 17 00:00:00 2001 From: michielderoos Date: Wed, 21 Jul 2021 14:35:57 -0300 Subject: [PATCH 7/8] - --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 47d20b4..2262a36 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -69,6 +69,6 @@ workflows: only: - master - deploy-with-circle - - test_deploy + - test-deploy requires: - build From c7ab935beb38ae9134ae9ad83dddc855c3c94445 Mon Sep 17 00:00:00 2001 From: michielderoos Date: Wed, 21 Jul 2021 14:56:02 -0300 Subject: [PATCH 8/8] logging --- main.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 36e91cd..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