Skip to content

Commit

Permalink
finished getting and managing coverage files
Browse files Browse the repository at this point in the history
Signed-off-by: Dhruv-J <[email protected]>
  • Loading branch information
Dhruv-J committed Jul 12, 2023
1 parent d744522 commit 50e8848
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 48 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/kind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ jobs:
- name: Tar log files
if: ${{ failure() }}
run: tar -czf log.tar.gz log
# - name: collect coverage files from node
# run: |
# docker cp $(docker inspect --format="{{.Id}}" kind-worker2):/var/log/cm-coverage/ ~/go/src/github.com/theia/.coverage
# docker cp $(docker inspect --format="{{.Id}}" kind-worker):/var/log/cm-coverage/. ~/go/src/github.com/theia/.coverage/cm-coverage
- name: Codecov
uses: codecov/codecov-action@v3
with:
Expand Down
11 changes: 6 additions & 5 deletions build/charts/theia/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
- name: clickhouse-monitor
image: {{ include "clickHouseMonitorImage" . | quote }}
imagePullPolicy: {{ $clickhouse.monitor.image.pullPolicy }}
volumeMounts:
- name: clickhouse-monitor-coverage
mountPath: /clickhouse-monitor-coverage
env:
- name: CLICKHOUSE_USERNAME
valueFrom:
Expand Down Expand Up @@ -32,7 +35,7 @@
- name: SKIP_ROUNDS_NUM
value: {{ $clickhouse.monitor.skipRoundsNum | quote }}
- name: GOCOVERDIR
value: {{ $clickhouse.monitor.gocoverdir }}
value: "/clickhouse-monitor-coverage"
{{- end }}

{{- define "clickhouse.server.container" }}
Expand All @@ -49,8 +52,6 @@
- name: clickhouse-storage-volume
mountPath: /var/lib/clickhouse
{{- end }}
- name: clickhouse-monitor-coverage-volume
mountPath: /clickhouse-monitor-coverage
env:
- name: THEIA_VERSION
value: {{ $Chart.Version }}
Expand Down Expand Up @@ -93,9 +94,9 @@
sizeLimit: {{ $clickhouse.storage.size }}
{{- end }}
- hostPath:
path: /var/log/coverage
path: /var/log/cm-coverage
type: DirectoryOrCreate
name: clickhouse-monitor-coverage-volume
name: clickhouse-monitor-coverage
{{- end }}


Expand Down
8 changes: 7 additions & 1 deletion build/charts/theia/templates/theia-manager/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ spec:
- name: CLICKHOUSE_URL
value: "tcp://clickhouse-clickhouse.{{ .Release.Namespace }}.svc:{{ .Values.clickhouse.service.tcpPort }}"
- name: GOCOVERDIR
value: {{ .Values.theiaManager.gocoverdir }}
value: "/theia-manager-coverage"
ports:
- name: "theia-api-http"
containerPort: {{ .Values.theiaManager.apiServer.apiPort }}
Expand All @@ -65,6 +65,8 @@ spec:
name: theia-manager-tls
- mountPath: /var/log/antrea/theia-manager
name: host-var-log-antrea-theia-manager
- mountPath: /theia-manager-coverage
name: theia-manager-coverage
nodeSelector:
kubernetes.io/os: linux
kubernetes.io/arch: amd64
Expand All @@ -83,4 +85,8 @@ spec:
hostPath:
path: /var/log/antrea/theia-manager
type: DirectoryOrCreate
- name: theia-manager-coverage
hostPath:
path: /var/log/tm-coverage
type: DirectoryOrCreate
{{- end }}
3 changes: 1 addition & 2 deletions build/charts/theia/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -272,5 +272,4 @@ theiaManager:
tlsMinVersion: ""
# -- Log verbosity switch for Theia Manager.
logVerbosity: 0
# -- coverage directory to be used
gocoverdir: theia-manager-coverage
# -- coverage directory to be used
19 changes: 13 additions & 6 deletions build/yamls/flow-visibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6944,7 +6944,7 @@ spec:
- name: CLICKHOUSE_URL
value: tcp://clickhouse-clickhouse.flow-visibility.svc:9000
- name: GOCOVERDIR
value: theia-manager-coverage
value: /theia-manager-coverage
image: projects.registry.vmware.com/antrea/theia-manager:latest
imagePullPolicy: IfNotPresent
name: theia-manager
Expand All @@ -6959,6 +6959,8 @@ spec:
name: theia-manager-tls
- mountPath: /var/log/antrea/theia-manager
name: host-var-log-antrea-theia-manager
- mountPath: /theia-manager-coverage
name: theia-manager-coverage
nodeSelector:
kubernetes.io/os: linux
serviceAccountName: theia-manager
Expand All @@ -6975,6 +6977,10 @@ spec:
path: /var/log/antrea/theia-manager
type: DirectoryOrCreate
name: host-var-log-antrea-theia-manager
- hostPath:
path: /var/log/tm-coverage
type: DirectoryOrCreate
name: theia-manager-coverage
---
apiVersion: apps/v1
kind: StatefulSet
Expand Down Expand Up @@ -7222,8 +7228,6 @@ spec:
name: clickhouse-configmap-volume
- mountPath: /var/lib/clickhouse
name: clickhouse-storage-volume
- mountPath: /clickhouse-monitor-coverage
name: clickhouse-monitor-coverage-volume
- env:
- name: CLICKHOUSE_USERNAME
valueFrom:
Expand Down Expand Up @@ -7252,10 +7256,13 @@ spec:
- name: SKIP_ROUNDS_NUM
value: "3"
- name: GOCOVERDIR
value: clickhouse-monitor-coverage
value: /clickhouse-monitor-coverage
image: projects.registry.vmware.com/antrea/theia-clickhouse-monitor:latest
imagePullPolicy: IfNotPresent
name: clickhouse-monitor
volumeMounts:
- mountPath: /clickhouse-monitor-coverage
name: clickhouse-monitor-coverage
volumes:
- configMap:
items:
Expand Down Expand Up @@ -7290,9 +7297,9 @@ spec:
sizeLimit: 8Gi
name: clickhouse-storage-volume
- hostPath:
path: /var/log/coverage
path: /var/log/cm-coverage
type: DirectoryOrCreate
name: clickhouse-monitor-coverage-volume
name: clickhouse-monitor-coverage
serviceTemplates:
- name: service-template
spec:
Expand Down
12 changes: 11 additions & 1 deletion ci/kind/test-e2e-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ function setup_cluster {
}

function run_test {
echo "STARTEDSTARTED_RUNNING"
TMP_DIR=$(mktemp -d $(dirname $0)/tmp.XXXXXXXX)
curl -o $TMP_DIR/antrea.yml https://raw.githubusercontent.com/antrea-io/antrea/main/build/yamls/antrea.yml
# cp ~/go/src/github.com/antrea/build/yamls/antrea.yml $TMP_DIR/flow-aggregator
Expand All @@ -161,35 +162,44 @@ function run_test {
sed -i -e "s/idleFlowExportTimeout: \"15s\"/idleFlowExportTimeout: \"1s\"/g" $TMP_DIR/antrea.yml

curl -o $TMP_DIR/flow-aggregator.yml https://raw.githubusercontent.com/antrea-io/antrea/main/build/yamls/flow-aggregator.yml
#cp ~/go/src/github.com/antrea/build/yamls/flow-aggregator.yml $TMP_DIR/flow-aggregator.yml
# cp ~/go/src/github.com/antrea/build/yamls/flow-aggregator.yml $TMP_DIR/flow-aggregator.yml
sed -i -e "s|image: projects.registry.vmware.com/antrea/flow-aggregator:latest|image: antrea/flow-aggregator:latest|g" $TMP_DIR/flow-aggregator.yml
perl -i -p0e 's/ # Enable is the switch to enable exporting flow records to ClickHouse.\n enable: false/ # Enable is the switch to enable exporting flow records to ClickHouse.\n enable: true/' $TMP_DIR/flow-aggregator.yml
sed -i -e "s/ activeFlowRecordTimeout: 60s/ activeFlowRecordTimeout: 3500ms/g" $TMP_DIR/flow-aggregator.yml
sed -i -e "s/ inactiveFlowRecordTimeout: 90s/ inactiveFlowRecordTimeout: 6s/g" $TMP_DIR/flow-aggregator.yml
sed -i -e "s/ podLabels: false/ podLabels: true/g" $TMP_DIR/flow-aggregator.yml
sed -i -e "s/ commitInterval: \"8s\"/ commitInterval: \"1s\"/g" $TMP_DIR/flow-aggregator.yml

echo "1MID_RUNNING"

docker exec -i kind-control-plane dd of=/root/antrea.yml < $TMP_DIR/antrea.yml
docker exec -i kind-control-plane dd of=/root/flow-aggregator.yml < $TMP_DIR/flow-aggregator.yml
docker exec -i kind-control-plane dd of=/root/clickhouse-operator-install-bundle.yaml < $CH_OPERATOR_YML
$FLOW_VISIBILITY_CMD | docker exec -i kind-control-plane dd of=/root/flow-visibility.yml
$FLOW_VISIBILITY_WITH_SPARK_CMD | docker exec -i kind-control-plane dd of=/root/flow-visibility-with-spark.yml
$FLOW_VISIBILITY_CH_ONLY_CMD | docker exec -i kind-control-plane dd of=/root/flow-visibility-ch-only.yml

echo "2MID_RUNNING"

docker exec -i kind-control-plane dd of=/root/theia < $THEIACTL_BIN

rm -rf $TMP_DIR
sleep 1

echo "3MID_RUNNING"

if $coverage; then
mkdir -p .coverage/clickhouse-monitor-coverage/
mkdir -p .coverage/theia-manager-coverage/
mkdir -p .coverage/merged
echo "STARTED_RUNNING"
go test -v -timeout=30m antrea.io/theia/test/e2e -provider=kind --logs-export-dir=$ANTREA_LOG_DIR -cover -coverprofile=.coverage/.cov.out -covermode=atomic --skip=$skiplist
else
go test -v -timeout=30m antrea.io/theia/test/e2e -provider=kind --logs-export-dir=$ANTREA_LOG_DIR --skip=$skiplist
fi

echo "FINISHED_RUNNING"

go tool covdata merge -i=.coverage/clickhouse-monitor-coverage,.coverage/theia-manager.coverage -o .coverage/merged
go tool covdata textfmt -i=.coverage/merged -o .coverage/kind-e2e-coverage.txt
}
Expand Down
Loading

0 comments on commit 50e8848

Please sign in to comment.