Skip to content

Commit

Permalink
fix e2e test in ci
Browse files Browse the repository at this point in the history
Signed-off-by: NKDYX <2374087322@qq.com>
  • Loading branch information
NKDYX committed Sep 19, 2022
1 parent b86e618 commit 17336dc
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 24 deletions.
Binary file modified build/helm/edgemesh-gateway.tgz
Binary file not shown.
Binary file modified build/helm/edgemesh.tgz
Binary file not shown.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ require (
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.16.0
github.com/spf13/cobra v1.2.1
github.com/spf13/pflag v1.0.5
github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852
istio.io/api v0.0.0-20220124163811-3adce9124ae7
istio.io/client-go v1.12.3
Expand Down
4 changes: 2 additions & 2 deletions hack/lib/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ edgemesh::lint::check() {
# skip deleted files
if [[ "$OSTYPE" == "darwin"* ]]
then
git diff --cached --name-only --diff-filter=ACRMTU main | grep -Ev "externalversions|fake|vendor|images|adopters" | xargs $SED_CMD -i 's/[ \t]*$//'
git diff --cached --name-only --diff-filter=ACRMTU main | grep -Ev "externalversions|fake|vendor|images|adopters|helm" | xargs $SED_CMD -i 's/[ \t]*$//'
elif [[ "$OSTYPE" == "linux"* ]]
then
git diff --cached --name-only --diff-filter=ACRMTU main | grep -Ev "externalversions|fake|vendor|images|adopters" | xargs --no-run-if-empty $SED_CMD -i 's/[ \t]*$//'
git diff --cached --name-only --diff-filter=ACRMTU main | grep -Ev "externalversions|fake|vendor|images|adopters|helm" | xargs --no-run-if-empty $SED_CMD -i 's/[ \t]*$//'
else
echo "Unsupported OS $OSTYPE"
exit 1
Expand Down
10 changes: 4 additions & 6 deletions hack/local-up-edgemesh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ build_component_image() {
}

load_images_to_master() {
kind load --name $CLUSTER_NAME docker-image $SERVER_IMAGE
kind load --name $CLUSTER_NAME docker-image $AGENT_IMAGE
}

Expand All @@ -165,15 +164,14 @@ prepare_k8s_env() {

start_edgemesh() {
echo "using helm to install edgemesh"
helm install edgemesh \
--set server.image=${SERVER_IMAGE} \
--set server.nodeName=${MASTER_NODENAME} \
helm install edgemesh --namespace kubeedge \
--set agent.image=${AGENT_IMAGE} \
--set agent.kubeAPIConfig.master=${KUBEAPI_PROXY_ADDR} \
--set agent.modules.edgeDNS.cacheDNS.enable=true \
--set agent.psk="edgemesh e2e test" \
--set agent.relayNodes[0].nodeName=${MASTER_NODENAME},agent.relayNodes[0].advertiseAddress={${HOST_IP}} \
./build/helm/edgemesh

kubectl wait --timeout=${TIMEOUT} --for=condition=Ready pod -l kubeedge=edgemesh-server -n kubeedge
kubectl wait --timeout=${TIMEOUT} --for=condition=Ready pod -l kubeedge=edgemesh-agent -n kubeedge

add_debug_info "See edgemesh status: kubectl get pod -n $NAMESPACE"
Expand Down Expand Up @@ -267,7 +265,7 @@ do_up() {

create_istio_crd

build_component_image agent server
build_component_image agent
load_images_to_master

start_edgemesh
Expand Down
2 changes: 1 addition & 1 deletion hack/verify-helm-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set -o pipefail

KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
EDGEMESH_HELM_DIR=${KUBE_ROOT}/build/helm/edgemesh
GATEWAY_HELM_DIR=${KUBE_ROOT}/build/helm/gateway
GATEWAY_HELM_DIR=${KUBE_ROOT}/build/helm/edgemesh-gateway
HELM_DIR=${KUBE_ROOT}/build/helm
_tmpdir=/tmp/edgemesh

Expand Down
25 changes: 11 additions & 14 deletions tests/e2e/scripts/fast_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,27 @@ workdir=`pwd`
cd $workdir

compilemodule=$1
runtest=$2
debugflag="-test.v -ginkgo.v"

#setup env
cd ../

export MASTER_IP=`docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' test-control-plane`
export KUBECONFIG=$HOME/.kube/config

export CHECK_EDGECORE_ENVIRONMENT="false"

#Pre-configurations required for running the suite.
#Any new config addition required corresponding code changes.
cat >config.json<<END
{
"k8smasterforkubeedge":"https://$MASTER_IP:6443",
"kubeconfigpath":"$KUBECONFIG"
}
END
export ACK_GINKGO_RC=true

if [ $# -eq 0 ]
then
#run testcase
sudo ./traffic/traffic.test $debugflag 2>&1 | sudo tee -a /tmp/testcase.log
ginkgo -v ./traffic/traffic.test -- \
--kube-master="https://$MASTER_IP:6443" \
--kubeconfig=$KUBECONFIG \
--test.v \
2>&1 | sudo tee -a /tmp/testcase.log
else
./$compilemodule/$compilemodule.test $debugflag $runtest 2>&1 | tee -a /tmp/testcase.log
ginkgo -v ./$compilemodule/$compilemodule.test -- \
--kube-master="https://$MASTER_IP:6443" \
--kubeconfig=$KUBECONFIG \
--test.v \
2>&1 | tee -a /tmp/testcase.log
fi
13 changes: 12 additions & 1 deletion tests/e2e/traffic/traffic_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package traffic

import (
"flag"
"math/rand"
"os"
"testing"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/spf13/pflag"

"github.com/kubeedge/edgemesh/tests/e2e/k8s"
"github.com/kubeedge/kubeedge/tests/e2e/utils"
Expand All @@ -19,6 +22,14 @@ var (
busyboxToolName = "busybox-edge-tools-" + utils.GetRandomString(5)
)

func TestMain(m *testing.M) {
utils.CopyFlags(utils.Flags, flag.CommandLine)
utils.RegisterFlags(flag.CommandLine)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
pflag.Parse()
os.Exit(m.Run())
}

func TestEdgeMeshTraffic(t *testing.T) {
rand.Seed(time.Now().Unix())
RegisterFailHandler(Fail)
Expand All @@ -41,5 +52,5 @@ func TestEdgeMeshTraffic(t *testing.T) {
err := k8s.CleanBusyBoxTool(busyboxToolName, ctx)
Expect(err).To(BeNil())
})
RunSpecs(t, "Traffic Suite")
RunSpecs(t, "EdgeMesh App Traffic Suite")
}
1 change: 1 addition & 0 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ github.com/spaolacci/murmur3
## explicit
github.com/spf13/cobra
# github.com/spf13/pflag v1.0.5
## explicit
github.com/spf13/pflag
# github.com/tinylib/msgp v1.1.2
github.com/tinylib/msgp/msgp
Expand Down

0 comments on commit 17336dc

Please sign in to comment.