Skip to content

Commit 22f4c43

Browse files
authored
Autotest (#85)
* first-round * second-set * third-push * push4 * push5 * push6 * push * push * push * push * fixes * fixes * fixes * fixes * fixes * fixes * fixes * terra optimizations * terra fixes * env.sh and fixes * docker login fix * take out vaults for now * fixes * fixes * fixes * fixes * fixes * fixes * fixes * Deploy fixes and new terraform * terraform reorg and fixes * oci_core_services fix * Update core.tf * Update core.tf * Update main-destroy.sh * fixes * Update core.tf * fixes * Update oke-setup.sh * fixes * Boost Node CPU and Memory * Rename states for clarity * Update containerengine.tf * Update main-setup.sh * Build perf and main-setup.sh restart * fix * compute shape and docker login enhancements * Update main-setup.sh * build perf tuning * build fixes * Update build-all.sh * Update oci-cli-cs-key-auth.sh * terraform 3 AD * Update oci-cli-cs-key-auth.sh * Update core.tf * fixes * Update core.tf * fixes Uncomment Internet Gateway Comment DHCP settings Move SSL creation to earlier Add wait for OKE to warm up * fixes PropSetup Back to single domain Wait for OKE nodes msdataworkshop alias cwallet.sso name change remove terraform-orig * fixes wallet.zip VM.Standard.B1.1 image Prune terraform status to 60 characters * fixes add cwallet.sso link rm wallet folder (for security) * fixes Destroy new object atp secrets wait for OKE improved logging and setup handling * minor fixes * Fixes Remove RUN_TYPE for now Execute JAVA_BUILD and NON_JAVA_BUILD from main-setup * Fixes No Key Generated messages Improve end of setup * Update containerengine.tf Change image shape * Fixes Hardening oke-setup Different Shape * Update oke-setup.sh Hardening * Parallel Destroy Make destroy run in parallel * chmod * Update main-setup.sh More hardening * Update main-setup.sh * Update oke-setup.sh More defensive code * Typo * SODA build + cleanup Replace SODA jar with maven dependency Remove old scripts Fix global deploy/undeploy scripts * Reorg Jaeger * Jaeger Fixes * DB Prep in Setup and DB Name Changes Moved DB Setup from Java to Shell Change DB Name to o and i * Fixes and Start of GB Integration * DB Name Changes * Update db-setup.sh Fixes * Update db-setup.sh * GB Integration and Prop Fixes * fixes * Update oci-cli-cs-key-auth.sh * Removed DB Setup from UI * Update oci-cli-cs-key-auth.sh * Dot Net and Go * Fixes * Manage Non-Java Builds Better * Update main-destroy.sh * Build Reorg * Update main-setup.sh Reorg password collection * Update main-setup.sh Minor fixes * Minor Fixes * Binding Changes * Fixes * Remove Legacy Code Removed admin-helidon, atp-setup, Removed initContainers from deployment yamls * Fixed inventory-helidon-se * Minor fixes * Fixes go build.sh fix * Update oke-setup.sh * Update db-setup.sh Fixed unprotected password * GB Fix and Autotest * Fixes * Update oke-setup.sh * Avoid Concurrent kubectl * Update oke-setup.sh * kubectl perf booster * kube token cache * Build reordering * Update main-setup.sh * Update main-setup.sh * Update main-setup.sh * Update main-setup.sh * Automatic Testing * Perms * Fixes * Update main-test.sh * Test Fixes * Update undeploy.sh * Scaling Tests * Fixes * Update main-test.sh * Update main-test.sh * Update polyglot-test.sh * Fixes * fixes * Test Summary * Update main-setup.sh
1 parent 96ee71e commit 22f4c43

File tree

11 files changed

+199
-109
lines changed

11 files changed

+199
-109
lines changed

grabdish/frontend-helidon/undeploy.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,4 @@
55

66
echo delete frontend deployment and service...
77

8-
kubectl delete deployment frontend-helidon -n msdataworkshop
9-
10-
kubectl delete service frontend -n msdataworkshop
8+
kubectl delete deployment frontend-helidon -n msdataworkshop

grabdish/terraform/core.tf

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ resource oci_core_service_gateway sg {
7070
}
7171
#route_table_id = <<Optional value not found in discovery>>
7272
services {
73-
service_id = data.oci_core_services.services.services.1.id
73+
service_id = data.oci_core_services.services.services.0.id
7474
}
7575
vcn_id = oci_core_vcn.okell_vcn.id
7676
}
@@ -87,7 +87,7 @@ resource oci_core_route_table private {
8787
}
8888
route_rules {
8989
description = "traffic to OCI services"
90-
destination = data.oci_core_services.services.services.1.cidr_block
90+
destination = data.oci_core_services.services.services.0.cidr_block
9191
destination_type = "SERVICE_CIDR_BLOCK"
9292
network_entity_id = oci_core_service_gateway.sg.id
9393
}
@@ -221,6 +221,7 @@ resource oci_core_security_list nodePool {
221221
}
222222
#udp_options = <<Optional value not found in discovery>>
223223
}
224+
/*
224225
egress_security_rules {
225226
description = "Allow nodes to communicate with OKE to ensure correct start-up and continued functioning (1)"
226227
destination = data.oci_core_services.services.services.1.cidr_block
@@ -235,6 +236,7 @@ resource oci_core_security_list nodePool {
235236
}
236237
#udp_options = <<Optional value not found in discovery>>
237238
}
239+
*/
238240
egress_security_rules {
239241
description = "ICMP Access from Kubernetes Control Plane"
240242
destination = "0.0.0.0/0"
@@ -343,20 +345,6 @@ resource oci_core_security_list nodePool {
343345
resource oci_core_security_list endpoint {
344346
compartment_id = var.ociCompartmentOcid
345347
display_name = "endpoint"
346-
egress_security_rules {
347-
description = "Allow Kubernetes Control Plane to communicate with OKE"
348-
destination = data.oci_core_services.services.services.1.cidr_block
349-
destination_type = "SERVICE_CIDR_BLOCK"
350-
#icmp_options = <<Optional value not found in discovery>>
351-
protocol = "6"
352-
stateless = "false"
353-
tcp_options {
354-
max = "443"
355-
min = "443"
356-
#source_port_range = <<Optional value not found in discovery>>
357-
}
358-
#udp_options = <<Optional value not found in discovery>>
359-
}
360348
egress_security_rules {
361349
description = "Allow Kubernetes Control Plane to communicate with OKE"
362350
destination = data.oci_core_services.services.services.0.cidr_block
@@ -459,4 +447,9 @@ resource oci_core_default_security_list svcLB {
459447
manage_default_resource_id = oci_core_vcn.okell_vcn.default_security_list_id
460448
}
461449
data "oci_core_services" "services" {
450+
filter {
451+
name = "name"
452+
values = ["All .* Services In Oracle Services Network"]
453+
regex = true
454+
}
462455
}

grabdish/test.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
# Make sure this is run via source or .
66
if ! (return 0 2>/dev/null); then
7-
echo "ERROR: Usage 'source test.sh $USER_OCID'"
7+
echo "ERROR: Usage 'source test.sh'"
88
exit
99
fi
1010

11-
TEST_SCRIPT="$GRABDISH_HOME/utils/main-test.sh"
12-
$TEST_SCRIPT 2>&1 | tee -ai $GRABDISH_LOG/main-test.log
11+
$GRABDISH_HOME/utils/main-test.sh 2>&1 | tee -ai $GRABDISH_LOG/main-test.log
12+
13+
$GRABDISH_HOME/utils/test-summary.sh

grabdish/utils/db-setup.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,6 @@ while ! state_done CWALLET_SSO_AUTH_URL; do
5555
done
5656

5757

58-
# Wait for DB Password
59-
while ! state_done DB_PASSWORD; do
60-
echo "`date`: Waiting for DB_PASSWORD"
61-
sleep 2
62-
done
63-
64-
6558
# Give DB_PASSWORD priority
6659
while ! state_done DB_PASSWORD; do
6760
echo "Waiting for DB_PASSWORD"

grabdish/utils/func-test.sh

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,53 @@
55
# Fail on error
66
set -e
77

8-
ORDER_ID="$1"
8+
TEST_STEP="$1"
9+
ORDER_ID="$2"
910

1011
function order() {
1112
echo '{"serviceName": "order", "commandName": "'"$2"'", "orderId": '"$1"', "orderItem": "sushi", "deliverTo": "780 PANORAMA DR, San francisco, CA"}'
1213
}
1314

1415
function inventory() {
15-
echo '{"serviceName": "supplier", "commandName": "'"$2"'", "orderId": "-1", "orderItem": '"$1"', "deliverTo": ""}'
16+
echo '{"serviceName": "supplier", "commandName": "'"$2"'", "orderId": -1, "orderItem": "'"$1"'", "deliverTo": ""}'
1617
}
1718

1819
function placeOrderTest() {
1920
# Place order
20-
if wget --http-user grabdish --http-password "$TEST_UI_PASSWORD" --no-check-certificate --post-data "$(order "$1" 'placeOrder')" \
21-
--header='Content-Type: application/json' "$(state_get FRONTEND_URL)/placeorder"; then
22-
echo "placeOrder $1 failed"
23-
return 1
21+
local ORDER_ID="$1"
22+
if wget --http-user grabdish --http-password "$TEST_UI_PASSWORD" --no-check-certificate --post-data "$(order "$ORDER_ID" 'placeOrder')" \
23+
--header='Content-Type: application/json' "$(state_get FRONTEND_URL)/placeorder" -O $GRABDISH_LOG/order; then
24+
echo "TEST_LOG: $TEST_STEP placeOrder $ORDER_ID succeeded"
25+
else
26+
echo "TEST_LOG_FAILED: $TEST_STEP placeOrder $ORDER_ID failed"
2427
fi
2528
}
2629

2730
function showOrderTest() {
28-
# Place order
29-
if wget --http-user grabdish --http-password "$TEST_UI_PASSWORD" --no-check-certificate --post-data "$(order "$1" 'showorder')" \
30-
--header='Content-Type: application/json' "$(state_get FRONTEND_URL)/command" > $GRUBDASH_LOG/order; then
31-
echo "showOrder $1 failed"
32-
return 1
31+
# Show order
32+
local ORDER_ID="$1"
33+
local SEARCH_FOR="$2"
34+
if wget --http-user grabdish --http-password "$TEST_UI_PASSWORD" --no-check-certificate --post-data "$(order "$ORDER_ID" 'showorder')" \
35+
--header='Content-Type: application/json' "$(state_get FRONTEND_URL)/command" -O $GRABDISH_LOG/order; then
36+
echo "TEST_LOG: $TEST_STEP showOrder request $1 succeeded"
37+
if grep "$SEARCH_FOR" $GRABDISH_LOG/order >/dev/null; then
38+
echo "TEST_LOG: $TEST_STEP showOrder $ORDER_ID matched"
39+
else
40+
echo "TEST_LOG_FAILED: $TEST_STEP showOrder $ORDER_ID nomatch"
41+
fi
42+
else
43+
echo "TEST_LOG_FAILED: $TEST_STEP showOrder request $1 failed"
3344
fi
34-
35-
echo $GRUBDASH_LOG/order
3645
}
3746

3847
function addInventoryTest() {
39-
# Place order
40-
if wget --http-user grabdish --http-password "$TEST_UI_PASSWORD" --no-check-certificate --post-data "$(inventory "$1" 'addInventory')" \
41-
--header='Content-Type: application/json' "$(state_get FRONTEND_URL)/command"; then
42-
echo "showOrder $1 failed"
43-
return 1
48+
# Add inventory
49+
local ITEM_ID="$1"
50+
if wget --http-user grabdish --http-password "$TEST_UI_PASSWORD" --no-check-certificate --post-data "$(inventory "$ITEM_ID" 'addInventory')" \
51+
--header='Content-Type: application/json' "$(state_get FRONTEND_URL)/command" -O $GRABDISH_LOG/inventory; then
52+
echo "TEST_LOG: $TEST_STEP addInventory $ITEM_ID succeeded"
53+
else
54+
echo "TEST_LOG_FAILED: $TEST_STEP addInventory $ITEM_ID request failed"
4455
fi
4556
}
4657

@@ -50,7 +61,7 @@ placeOrderTest $ORDER_ID
5061

5162
sleep 5
5263

53-
showOrderTest $ORDER_ID 'no inventory'
64+
showOrderTest $ORDER_ID 'failed inventory does not exist'
5465

5566

5667
# Add inventory
@@ -64,4 +75,4 @@ placeOrderTest "$ORDER_ID"
6475

6576
sleep 5
6677

67-
showOrderTest "$ORDER_ID" 'inventory exists'
78+
showOrderTest "$ORDER_ID" 'success inventory exists'

grabdish/utils/main-setup.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ while ! state_done COMPARTMENT_OCID; do
113113
else
114114
read -p "Please enter your OCI compartments's OCID: " COMPARTMENT_OCID
115115
fi
116-
while ! test `oci iam compartment get --compartment-id "$COMPARTMENT_OCID" --query 'data."lifecycle-state"' --raw-output`"" == 'ACTIVE' 2>/dev/null; do
116+
while ! test `oci iam compartment get --compartment-id "$COMPARTMENT_OCID" --query 'data."lifecycle-state"' --raw-output 2>/dev/null`"" == 'ACTIVE'; do
117117
echo "Waiting for the compartment to become ACTIVE"
118118
sleep 2
119119
done
@@ -221,11 +221,14 @@ while ! state_done DOCKER_REGISTRY; do
221221
fi
222222
else
223223
read -s -r -p "Please generate an Auth Token and enter the value: " TOKEN
224+
echo
225+
echo "Auth Token entry accepted. Attempting docker login."
224226
fi
225227

226228
RETRIES=0
227229
while test $RETRIES -le 30; do
228230
if echo "$TOKEN" | docker login -u "$(state_get NAMESPACE)/$(state_get USER_NAME)" --password-stdin "$(state_get REGION).ocir.io" &>/dev/null; then
231+
echo "Docker login completed"
229232
state_set DOCKER_REGISTRY "$(state_get REGION).ocir.io/$(state_get NAMESPACE)/$(state_get RUN_NAME)"
230233
export OCI_CLI_PROFILE=$(state_get REGION)
231234
break

grabdish/utils/main-test.sh

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,36 @@ set -e
77

88
# Check home is set
99
if test -z "$GRABDISH_HOME"; then
10-
echo "ERROR: This script requires GRABDISH_HOME to be set"
10+
echo "TEST_LOG_FAILED: This script requires GRABDISH_HOME to be set"
1111
exit
1212
fi
1313

14-
15-
# SETUP
16-
export TEST_DB_PASSWORD='Welcome12345;#!:'
17-
# export TEST_UI_PASSWORD='Welcome1;"#!:'
18-
export TEST_UI_PASSWORD='Welcome1'
1914
if ! state_done SETUP_VERIFIED; then
20-
docker image prune -a -f
21-
source setup.sh
15+
echo "TEST_LOG_FAILED: Setup is incomplete"
16+
exit
2217
fi
2318

24-
if ! state_done SETUP_VERIFIED; then
25-
echo "SETUP failed"
26-
return 1
27-
fi
19+
# Check TEST_UI_PASSWORD is set
20+
export TEST_UI_PASSWORD=`kubectl get secret frontendadmin -n msdataworkshop --template={{.data.password}} | base64 --decode`
21+
22+
23+
echo 'TEST_LOG: #####################################'
2824

2925
# WALKTHROUGH
3026
# Deploy the java services
27+
echo "TEST_LOG: #### Testing Lab2: Walkthrough"
3128
./deploy.sh
3229

33-
sleep 60
30+
while test 4 -gt `kubectl get pods -n msdataworkshop | egrep 'frontend-helidon|inventory-helidon|order-helidon|supplier-helidon-se' | grep "1/1" | wc -l`; do
31+
echo "Waiting for pods to start..."
32+
sleep 10
33+
done
3434

3535
# Get the frontend URL
3636
RETRIES=0
3737
while ! state_done FRONTEND_URL; do
38-
if IP=`kubectl get services -n msdataworkshop | awk '/frontend/ {print $4}'`; then
38+
IP=`kubectl get services -n msdataworkshop | awk '/frontend/ {print $4}'`
39+
if [[ "$IP" =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
3940
state_set FRONTEND_URL "https://$IP"
4041
else
4142
RETRIES=$(($RETRIES + 1))
@@ -47,30 +48,44 @@ while ! state_done FRONTEND_URL; do
4748
fi
4849
done
4950

51+
5052
# Is the UI available?
5153
if wget -qO- --no-check-certificate --http-user grabdish --http-password "$TEST_UI_PASSWORD" "$(state_get FRONTEND_URL)" | grep 'GrabDish Explorer' >/dev/null; then
52-
echo "ERROR: UI Unavailable"
54+
echo "TEST_LOG: Frontend UI Available"
55+
else
56+
echo "TEST_LOG_FAILED: Frontend UI Unavailable"
57+
exit
5358
fi
5459

5560
# Functional test on order 66/67
56-
utils/func-test.sh 66
61+
utils/func-test.sh Walkthrough 66
5762

5863

5964
# POLYGLOT
65+
echo "TEST_LOG: #### Testing Lab3: Polyglot"
66+
6067
# Deploy each inventory service and perform functional test
68+
while ! $(state_get NON_JAVA_BUILDS); do
69+
sleep 10
70+
echo "Waiting for NON_JAVA_BUILDS"
71+
done
72+
6173
utils/polyglot-test.sh
6274

6375

6476
# SCALING
65-
# utils/scaling-test.sh
77+
echo "TEST_LOG: #### Testing Lab4: Scaling"
78+
utils/scaling-test.sh
6679

6780

6881
# TRACING
69-
# TODO
82+
echo "TEST_LOG: #### Testing Lab5: Tracing"
83+
utils/tracing-test.sh
84+
7085

7186
# APEX
7287
# TODO
7388

7489

7590
# TEARDOWN
76-
source destroy.sh
91+
# source destroy.sh

grabdish/utils/polyglot-test.sh

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,26 @@ set -e
99
SERVICES="inventory-python inventory-nodejs inventory-dotnet inventory-go inventory-helidon-se"
1010
ORDER_ID=66
1111

12-
PREV_SERVICE="inventory-helidon"
12+
cd $GRABDISH_HOME/inventory-helidon
13+
./undeploy.sh
14+
1315
for s in $SERVICES; do
1416
echo "Testing $s"
15-
cd $GRABDISH_HOME/"$PREV_SERVICE"
16-
./undeploy.sh
1717
cd $GRABDISH_HOME/$s
1818
./deploy.sh
19-
sleep 60
19+
20+
while test 1 -gt `kubectl get pods -n msdataworkshop | grep "${s}" | grep "1/1" | wc -l`; do
21+
echo "Waiting for pod to start..."
22+
sleep 5
23+
done
24+
2025
cd $GRABDISH_HOME
2126
ORDER_ID=$(($ORDER_ID + 100))
22-
utils/func-test.sh $ORDER_ID
23-
PREV_SERVICE=$s
24-
done
27+
utils/func-test.sh "Polyglot $s" $ORDER_ID
28+
29+
cd $GRABDISH_HOME/$s
30+
./undeploy.sh
31+
done
32+
33+
cd $GRABDISH_HOME/inventory-helidon
34+
./deploy.sh

0 commit comments

Comments
 (0)