Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Policy Recommendation e2e test #77

Merged
merged 3 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 42 additions & 2 deletions .github/workflows/kind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,26 @@ jobs:
outputs:
has_changes: ${{ steps.check_diff.outputs.has_changes }}

test-e2e-encap:
name: E2e tests on a Kind cluster on Linux
build-policy-recommendation-image:
name: Build Policy Recommendation image to be used for Kind e2e tests
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' }}
runs-on: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v3
- run: make policy-recommendation
- name: Save Policy Recommendation image to tarball
run: docker save -o policy-recommendation.tar antrea/theia-policy-recommendation
- name: Upload Policy Recommendation image for subsequent jobs
uses: actions/upload-artifact@v3
with:
name: policy-recommendation
path: policy-recommendation.tar
retention-days: 1 # minimum value, in case artifact deletion by 'artifact-cleanup' job fails

test-e2e-encap:
name: E2e tests on a Kind cluster on Linux
needs: build-policy-recommendation-image
runs-on: [ubuntu-latest]
steps:
- name: Free disk space
Expand All @@ -44,6 +60,14 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Download Theia images from previous jobs
uses: actions/download-artifact@v3
dreamtalen marked this conversation as resolved.
Show resolved Hide resolved
with:
name: policy-recommendation
- name: Load Theia image
run: |
docker load -i policy-recommendation.tar
docker tag antrea/theia-policy-recommendation:latest projects.registry.vmware.com/antrea/theia-policy-recommendation:latest
- name: Install Kind
run: |
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
Expand All @@ -63,3 +87,19 @@ jobs:
name: e2e-kind-fa.tar.gz
path: log.tar.gz
retention-days: 30

# Runs after all other jobs in the workflow and deletes Theia Docker images uploaded as temporary
# artifacts. It uses a third-party, MIT-licensed action (geekyeggo/delete-artifact). While Github
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not familiar with how temporary artifacts are managed, will there be possible conflicts if multi images are uploaded and deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Ziyou, if there are multiple jobs uploading a same image, the later jobs will overwrite what was previously uploaded. I think this won't be a problem for our testing usage?

# exposes an API for deleting artifacts, they do not support an official delete-artifact action
# yet.
artifact-cleanup:
name: Delete uploaded images
needs: [build-policy-recommendation-image, test-e2e-encap]
if: ${{ always() && needs.build-policy-recommendation-image.result == 'success' }}
heanlan marked this conversation as resolved.
Show resolved Hide resolved
runs-on: [ubuntu-latest]
steps:
- name: Delete policy-recommendation
if: ${{ needs.build-policy-recommendation-image.result == 'success' }}
uses: geekyeggo/delete-artifact@v1
with:
name: policy-recommendation
4 changes: 2 additions & 2 deletions ci/jenkins/test-vmc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -345,15 +345,15 @@ function deliver_antrea {
(cd $GIT_CHECKOUT_DIR && make theia-linux)
${SCP_WITH_ANTREA_CI_KEY} $GIT_CHECKOUT_DIR/bin/theia-linux capv@${control_plane_ip}:~/theia


# copy images
docker pull projects.registry.vmware.com/antrea/antrea-ubuntu:latest
docker pull projects.registry.vmware.com/antrea/flow-aggregator:latest
docker pull projects.registry.vmware.com/antrea/theia-spark-operator:v1beta2-1.3.3-3.1.1
docker pull projects.registry.vmware.com/antrea/theia-policy-recommendation:latest
docker save -o antrea-ubuntu.tar projects.registry.vmware.com/antrea/antrea-ubuntu:latest
docker save -o flow-aggregator.tar projects.registry.vmware.com/antrea/flow-aggregator:latest
docker save -o theia-spark-operator.tar projects.registry.vmware.com/antrea/theia-spark-operator:v1beta2-1.3.3-3.1.1

(cd $GIT_CHECKOUT_DIR && make policy-recommendation)
docker save -o theia-policy-recommendation.tar projects.registry.vmware.com/antrea/theia-policy-recommendation:latest

# not sure the exact image tag, so read from yaml
Expand Down
4 changes: 2 additions & 2 deletions ci/kind/test-e2e-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ COMMON_IMAGES_LIST=("k8s.gcr.io/e2e-test-images/agnhost:2.29" \
"projects.registry.vmware.com/antrea/theia-clickhouse-server:21.11" \
"projects.registry.vmware.com/antrea/theia-clickhouse-monitor:latest" \
"projects.registry.vmware.com/antrea/theia-grafana:8.3.3" \
"projects.registry.vmware.com/antrea/theia-spark-operator:v1beta2-1.3.3-3.1.1" \
"projects.registry.vmware.com/antrea/theia-policy-recommendation:latest")
"projects.registry.vmware.com/antrea/theia-spark-operator:v1beta2-1.3.3-3.1.1")

for image in "${COMMON_IMAGES_LIST[@]}"; do
for i in `seq 3`; do
Expand All @@ -123,6 +122,7 @@ for image in "${COMMON_IMAGES_LIST[@]}"; do
done
done

COMMON_IMAGES_LIST+=("projects.registry.vmware.com/antrea/theia-policy-recommendation:latest")
printf -v COMMON_IMAGES "%s " "${COMMON_IMAGES_LIST[@]}"

function setup_cluster {
Expand Down
12 changes: 0 additions & 12 deletions test/e2e/flowvisibility_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,6 @@ func testHelper(t *testing.T, data *TestData, podAIPs, podBIPs, podCIPs, podDIPs
if err != nil {
failOnError(fmt.Errorf("error when creating perftest Services: %v", err), t, data)
}
defer deletePerftestServices(t, data)
// Wait for the Service to be realized.
time.Sleep(3 * time.Second)

// IntraNodeFlows tests the case, where Pods are deployed on same Node
// and their flow information is exported as IPFIX flow records.
Expand Down Expand Up @@ -1180,15 +1177,6 @@ func createPerftestServices(data *TestData, isIPv6 bool) (svcB *corev1.Service,
return svcB, svcC, nil
}

func deletePerftestServices(t *testing.T, data *TestData) {
for _, serviceName := range []string{"perftest-b", "perftest-c"} {
err := data.deleteService(testNamespace, serviceName)
if err != nil {
t.Logf("Error when deleting %s Service: %v", serviceName, err)
}
}
}

// getBandwidthAndPorts parses iperf commands output and returns bandwidth,
// source port and destination port. Bandwidth is returned as a slice containing
// two strings (bandwidth value and bandwidth unit).
Expand Down
Loading