Skip to content

Commit

Permalink
bats - add shed-kubectl-scale
Browse files Browse the repository at this point in the history
  • Loading branch information
siakhooi committed Apr 18, 2024
1 parent 105d2e9 commit 1c93835
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
hello-world
hello-world-scalable
22 changes: 22 additions & 0 deletions tests/bats-test-scripts/shed-kubectl-scale/k-scale.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
setup(){
load '../common-setup'
common_setup
}
@test "k-scale" {
run bash -ic 'k-scale'
assert_success
cat_expected "shed-kubectl-scale-usage" | assert_output -
}
@test "k-scale xxx" {
run bash -ic 'k-scale xxx'
assert_success
cat_expected "shed-kubectl-scale-usage" | assert_output -
}
@test "k-scale 2 hello-world-scalable" {
shed-kubectl-apply hello-world-scalable
run bash -ic 'k-scale 2 deployments/hello-world-scalable'
assert_success
cat_expected "shed-kubectl-scale" | assert_output -
shed-kubectl delete deployments/hello-world-scalable
shed-kubectl wait --for delete pod --selector=app=hello-world-scalable --timeout 60s
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Usage: shed-kubectl-scale replicas resourceName
22 changes: 22 additions & 0 deletions tests/bats-test-scripts/shed-kubectl-scale/shed-kubectl-scale.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
setup(){
load '../common-setup'
common_setup
}
@test "shed-kubectl-scale" {
run shed-kubectl-scale
assert_success
cat_expected "shed-kubectl-scale-usage" | assert_output -
}
@test "shed-kubectl-scale xxx" {
run shed-kubectl-scale xxx
assert_success
cat_expected "shed-kubectl-scale-usage" | assert_output -
}
@test "shed-kubectl-scale 2 hello-world-scalable" {
shed-kubectl-apply hello-world-scalable
run shed-kubectl-scale 2 deployments/hello-world-scalable
assert_success
cat_expected "shed-kubectl-scale" | assert_output -
shed-kubectl delete deployments/hello-world-scalable
shed-kubectl wait --for delete pod --selector=app=hello-world-scalable --timeout 60s
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
+ kubectl --context kube-dev-1 --namespace ns-application scale --replicas=2 deployments/hello-world-scalable
deployment.apps/hello-world-scalable scaled
22 changes: 22 additions & 0 deletions tests/bats-test-scripts/shed-kubectl-scale/shed_kubectl-scale.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
setup(){
load '../common-setup'
common_setup
}
@test "shed kubectl-scale" {
run shed kubectl-scale
assert_success
cat_expected "shed-kubectl-scale-usage" | assert_output -
}
@test "shed kubectl-scale xxx" {
run shed kubectl-scale xxx
assert_success
cat_expected "shed-kubectl-scale-usage" | assert_output -
}
@test "shed kubectl-scale 2 hello-world-scalable" {
shed-kubectl-apply hello-world-scalable
run shed kubectl-scale 2 deployments/hello-world-scalable
assert_success
cat_expected "shed-kubectl-scale" | assert_output -
shed-kubectl delete deployments/hello-world-scalable
shed-kubectl wait --for delete pod --selector=app=hello-world-scalable --timeout 60s
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world-scalable
spec:
replicas: 1
selector:
matchLabels:
app: hello-world-scalable
template:
metadata:
labels:
app: hello-world-scalable
spec:
containers:
- image: busybox
imagePullPolicy: IfNotPresent
name: say-hello
command:
- bin/sh
- -c
- "while true; do echo 'Hello World!' ; sleep 2; done"
resources:
limits:
cpu: 300m
memory: 256Mi
requests:
cpu: 100m
memory: 128Mi

0 comments on commit 1c93835

Please sign in to comment.