From c99b1dc57e6cdafc04abc1320b511decf299f4e7 Mon Sep 17 00:00:00 2001 From: Yan <100032599+whykay-01@users.noreply.github.com> Date: Tue, 30 Apr 2024 20:38:36 +0000 Subject: [PATCH 1/3] feat: made sure the test case is testing for the proper thing --- features/shopcarts.feature | 13 ++++--------- service/static/js/rest_api.js | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/features/shopcarts.feature b/features/shopcarts.feature index ba69b40..01dc169 100644 --- a/features/shopcarts.feature +++ b/features/shopcarts.feature @@ -143,7 +143,7 @@ Feature: The shopcarts service back-end And the "Item Product ID" field should not be empty And the "Item Product Price" field should not be empty And the "Item Quantity" field should not be empty - + # LIST ALL ITEMS IN SHOPCART Scenario: List all items in shopcart When I visit the "Home Page" @@ -152,11 +152,6 @@ Feature: The shopcarts service back-end Then I should see the message "Success" When I copy the "Shopcart ID" field And I paste the "Item Shopcart ID" field - And I press the "Search Item" button - Then the "Item ID" field should not be empty - And the "Item Product Name" field should not be empty - And the "Item Product ID" field should not be empty - And the "Item Product Price" field should not be empty - And the "Item Quantity" field should not be empty - - \ No newline at end of file + When I press the "Search Item" button + Then I should see "1" under the row "Product ID 1" in the table + And I should see "3" under the row "Product ID 3" in the table \ No newline at end of file diff --git a/service/static/js/rest_api.js b/service/static/js/rest_api.js index 8499dcc..fb3b007 100644 --- a/service/static/js/rest_api.js +++ b/service/static/js/rest_api.js @@ -454,7 +454,7 @@ $(function () { let firstItem = ""; for (let i = 0; i < res.length; i++) { let item = res[i]; - table += `${item.cart_id}${item.id}${item.product_name}${item.product_id}${item.product_price}${item.quantity}${item.subtotal}`; + table += `${item.cart_id}${item.id}${item.product_name}${item.product_id}${item.product_price}${item.quantity}${item.subtotal}`; if (i == 0) { firstItem = item; } From e17c0faaf7ddaaec1ee90a620f2e8481499f9311 Mon Sep 17 00:00:00 2001 From: Yan <100032599+whykay-01@users.noreply.github.com> Date: Tue, 30 Apr 2024 20:40:22 +0000 Subject: [PATCH 2/3] fix: modified the build-docker command --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 91b79ef..6f3f314 100644 --- a/Makefile +++ b/Makefile @@ -72,10 +72,10 @@ deploy: ## Deploy the service on local Kubernetes .PHONY: build-docker build-docker: ## Build the docker image and push it to the registry $(info Building the docker image and pushing it to the registry...) - docker build -t shopcarts:1.0 . + docker build -t shopcarts:latest . sudo bash -c "echo '127.0.0.1 cluster-registry' >> /etc/hosts" - docker tag shopcarts:1.0 cluster-registry:32000/shopcarts:1.0 - docker push cluster-registry:32000/shopcarts:1.0 + docker tag shopcarts:latest cluster-registry:32000/shopcarts:latest + docker push cluster-registry:32000/shopcarts:latest .PHONY: setup-cluster setup-cluster: ## Setup the cluster and deploy the service From 4a2891a48573c06911f3da8ea3883b0dfaaec723 Mon Sep 17 00:00:00 2001 From: Yan <100032599+whykay-01@users.noreply.github.com> Date: Tue, 30 Apr 2024 20:40:51 +0000 Subject: [PATCH 3/3] chore: switched imagePullPolicy to "Always" --- k8s/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index 4f0e076..8e502e5 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -23,7 +23,7 @@ spec: containers: - name: shopcarts image: cluster-registry:32000/shopcarts:latest - imagePullPolicy: IfNotPresent + imagePullPolicy: Always ports: - containerPort: 8080 protocol: TCP