Skip to content

Commit d6dc0da

Browse files
committed
test: optimizations
Signed-off-by: Peter Wilcsinszky <[email protected]>
1 parent 82bf9a4 commit d6dc0da

File tree

7 files changed

+85
-41
lines changed

7 files changed

+85
-41
lines changed

.github/workflows/e2e.yaml

Lines changed: 74 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,48 @@ env:
1313

1414
jobs:
1515
build:
16+
name: Image build
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v2
24+
25+
- name: Build and export
26+
uses: docker/build-push-action@v4
27+
with:
28+
context: .
29+
tags: controller:local
30+
outputs: type=docker,dest=/tmp/controller.tar
31+
32+
- name: Upload artifact
33+
uses: actions/upload-artifact@v3
34+
with:
35+
name: controller
36+
path: /tmp/controller.tar
37+
38+
go:
1639
name: Go end2end tests
1740
runs-on: ubuntu-latest
41+
needs: build
1842

1943
steps:
44+
- name: Set up Docker Buildx
45+
uses: docker/setup-buildx-action@v2
46+
47+
- name: Download artifact
48+
uses: actions/download-artifact@v3
49+
with:
50+
name: controller
51+
path: /tmp
52+
53+
- name: Load image
54+
run: |
55+
docker load --input /tmp/controller.tar
56+
docker image ls -a
57+
2058
- name: Set up Go
2159
uses: actions/setup-go@v4
2260
with:
@@ -30,6 +68,9 @@ jobs:
3068
- name: Checkout code
3169
uses: actions/checkout@v3
3270

71+
- name: Make docker-build
72+
run: make docker-build
73+
3374
- name: Run e2e tests
3475
run: make test-e2e
3576

@@ -41,11 +82,26 @@ jobs:
4182
path: build/_test
4283
retention-days: 5
4384

44-
basic_flow:
85+
chart-minio:
4586
name: Shell script tests with chart install
4687
runs-on: ubuntu-latest
88+
needs: build
4789

4890
steps:
91+
- name: Set up Docker Buildx
92+
uses: docker/setup-buildx-action@v2
93+
94+
- name: Download artifact
95+
uses: actions/download-artifact@v3
96+
with:
97+
name: controller
98+
path: /tmp
99+
100+
- name: Load image
101+
run: |
102+
docker load --input /tmp/controller.tar
103+
docker image ls -a
104+
49105
- name: Set up Go
50106
uses: actions/setup-go@v4
51107
with:
@@ -59,32 +115,27 @@ jobs:
59115
- name: Checkout code
60116
uses: actions/checkout@v3
61117

62-
- name: Set up KinD
63-
run: make kind-cluster
64-
65-
- name: Stern
66-
run: make stern && test -x bin/stern
118+
- name: Make docker-build
119+
run: make docker-build
67120

68-
- name: Build controller image
69-
run: make docker-build IMG='controller:local'
121+
- name: Make setup
122+
run: make kind-cluster stern
70123

71-
- name: Create logging namespace
72-
run: kubectl create namespace logging
73-
74-
- name: Start MinIO
124+
- name: Kubernetes setup
75125
run: |
126+
kubectl create namespace logging
127+
76128
kubectl create -f hack/minio.yaml
77-
kubectl wait --namespace logging --for=condition=available deployment/minio-deployment --timeout=120s
78-
minio="$(kubectl get pod --namespace logging -l app=minio -o 'jsonpath={.items[0].metadata.name}')"
79-
kubectl wait --namespace logging --for=condition=Ready pod "${minio}" --timeout=120s
80-
81-
- name: Setup MinIO CLI
82-
run: |
83-
kubectl create -f hack/minio-mc.yaml
84-
kubectl wait --namespace logging --for=condition=available deployment/minio-mc-deployment --timeout=120s
85-
mc_pod="$(kubectl get pod --namespace logging -l app=minio-mc -o 'jsonpath={.items[0].metadata.name}')"
86-
kubectl wait --namespace logging --for=condition=Ready pod "${mc_pod}" --timeout=120s
87-
kubectl exec --namespace logging "${mc_pod}" -- \
129+
kubectl wait -n logging --for=condition=available deployment/minio-deployment --timeout=120s
130+
minio="$(kubectl get pod -n logging -l app=minio -o 'jsonpath={.items[0].metadata.name}')"
131+
kubectl wait -n logging --for=condition=Ready pod "${minio}" --timeout=120s
132+
133+
kubectl create -n logging -f hack/minio-mc.yaml
134+
kubectl wait -n logging --for=condition=available deployment/minio-mc-deployment --timeout=120s
135+
mc_pod="$(kubectl get pod -n logging -l app=minio-mc -o 'jsonpath={.items[0].metadata.name}')"
136+
kubectl wait -n logging --for=condition=Ready pod "${mc_pod}" --timeout=120s
137+
138+
kubectl exec -n logging "${mc_pod}" -- \
88139
mc config host add minio \
89140
'http://minio-service.logging.svc.cluster.local:9000' \
90141
'minio_access_key' \

hack/clusterflow.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ apiVersion: logging.banzaicloud.io/v1beta1
22
kind: ClusterFlow
33
metadata:
44
name: all-log-to-s3
5-
namespace: logging
65
spec:
76
filters:
87
- tag_normaliser: {}

hack/clusteroutput.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ apiVersion: logging.banzaicloud.io/v1beta1
22
kind: ClusterOutput
33
metadata:
44
name: s3-output
5-
namespace: logging
65
spec:
76
s3:
87
aws_key_id:

hack/minio-mc.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ apiVersion: apps/v1
22
kind: Deployment
33
metadata:
44
name: minio-mc-deployment
5-
namespace: logging
65
spec:
76
selector:
87
matchLabels:

hack/minio.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ apiVersion: apps/v1
22
kind: Deployment
33
metadata:
44
name: minio-deployment
5-
namespace: logging
65
spec:
76
selector:
87
matchLabels:

hack/secret.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ apiVersion: v1
22
kind: Secret
33
metadata:
44
name: logging-s3
5-
namespace: logging
65
type: Opaque
76
data:
87
awsAccessKeyId: bWluaW9fYWNjZXNzX2tleQ==

hack/test.sh

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function main()
1212
local mc_pod="$(get_mc_pod_name)"
1313
remove_test_bucket "${mc_pod}"
1414
create_test_bucket "${mc_pod}"
15-
kubectl apply -f "${SCRIPT_PATH}/secret.yaml"
15+
kubectl apply -n logging -f "${SCRIPT_PATH}/secret.yaml"
1616
helm_deploy_logging_operator
1717
configure_logging
1818

@@ -31,14 +31,14 @@ function load_images()
3131
function remove_test_bucket()
3232
{
3333
local mc_pod="$1"
34-
kubectl exec --namespace logging "${mc_pod}" -- \
34+
kubectl exec -n logging "${mc_pod}" -- \
3535
mc rb "${BUCKET}" || true
3636
}
3737

3838
function create_test_bucket()
3939
{
4040
local mc_pod="$1"
41-
kubectl exec --namespace logging "${mc_pod}" -- \
41+
kubectl exec -n logging "${mc_pod}" -- \
4242
mc mb --region 'test_region' "${BUCKET}"
4343
}
4444

@@ -50,13 +50,11 @@ function helm_add_repo()
5050

5151
function helm_deploy_logging_operator()
5252
{
53-
# TODO: remove version once there is a semver stable version in the repo
5453
helm upgrade --install \
5554
--debug \
5655
--wait \
5756
--set image.tag='local' \
5857
--set image.repository='controller' \
59-
--version 4.0.0 \
6058
logging-operator \
6159
"e2e/charts/logging-operator"
6260
}
@@ -67,16 +65,16 @@ function configure_logging()
6765
--debug \
6866
--wait \
6967
--create-namespace \
70-
--namespace logging \
68+
-n logging \
7169
'logging-operator-logging-tls' \
7270
"e2e/charts/logging-operator-logging"
73-
kubectl apply -f "${SCRIPT_PATH}/clusteroutput.yaml"
74-
kubectl apply -f "${SCRIPT_PATH}/clusterflow.yaml"
71+
kubectl apply -n logging -f "${SCRIPT_PATH}/clusteroutput.yaml"
72+
kubectl apply -n logging -f "${SCRIPT_PATH}/clusterflow.yaml"
7573
}
7674

7775
function get_mc_pod_name()
7876
{
79-
kubectl get pod --namespace logging -l app=minio-mc -o 'jsonpath={.items[0].metadata.name}'
77+
kubectl get pod -n logging -l app=minio-mc -o 'jsonpath={.items[0].metadata.name}'
8078
}
8179

8280
function wait_for_log_files()
@@ -93,8 +91,8 @@ function wait_for_log_files()
9391
done
9492

9593
echo 'Cannot find any log files within timeout'
96-
kubectl get pod,svc --namespace logging
97-
kubectl exec -it --namespace logging logging-operator-logging-fluentd-0 cat /fluentd/log/out
94+
kubectl get pod,svc -n logging
95+
kubectl exec -it -n logging logging-operator-logging-fluentd-0 cat /fluentd/log/out
9896
exit 1
9997
}
10098

@@ -109,14 +107,14 @@ function get_log_files()
109107
{
110108
local mc_pod="$1"
111109

112-
kubectl exec --namespace logging "${mc_pod}" -- mc find "${BUCKET}" --name '*.gz'
110+
kubectl exec -n logging "${mc_pod}" -- mc find "${BUCKET}" --name '*.gz'
113111
}
114112

115113
function print_logs()
116114
{
117115
local mc_pod="$1"
118116

119-
kubectl exec --namespace logging "${mc_pod}" -- mc find "${BUCKET}" --name '*.gz' -exec 'mc cat {}' | gzip -d
117+
kubectl exec -n logging "${mc_pod}" -- mc find "${BUCKET}" --name '*.gz' -exec 'mc cat {}' | gzip -d
120118
}
121119

122120
main "$@"

0 commit comments

Comments
 (0)