Navigation Menu

Skip to content

Commit

Permalink
WIP: test for e2e test.
Browse files Browse the repository at this point in the history
  • Loading branch information
chendave committed Nov 22, 2019
1 parent c6a5aa7 commit 7b2514c
Show file tree
Hide file tree
Showing 10 changed files with 368 additions and 2,439 deletions.
131 changes: 67 additions & 64 deletions .travis.yml
Expand Up @@ -10,13 +10,13 @@ services:
go:
- 1.12

before_install:
- |
if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md)|(\.png)|(\.pdf)|(\.html)|^(LICENSE)|^(docs)'
then
echo "Only doc files were updated, skip running the CI."
exit
fi
#before_install:
# - |
# if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md)|(\.png)|(\.pdf)|(\.html)|^(LICENSE)|^(docs)'
# then
# echo "Only doc files were updated, skip running the CI."
# exit
# fi

before_script:
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | BINARY=golangci-lint sh -s -- -d -b $(go env GOPATH)/bin v1.20.0
Expand All @@ -36,71 +36,74 @@ install: true

jobs:
include:
- stage: "Verify vendor"
script: make verify
name: "check if the vendor is up to date"
# - stage: "Verify vendor"
# script: make verify
# name: "check if the vendor is up to date"

- stage: "Test lint"
script: make cloud_lint
name: "cloud_lint"
- script: make bluetoothdevice_lint
name: "bluetooth_device_lint"
- script: make keadm_lint
name: "keadm_lint"
- script: make edge_lint
name: "edge_lint"
# - stage: "Test lint"
# script: make cloud_lint
# name: "cloud_lint"
# - script: make bluetoothdevice_lint
# name: "bluetooth_device_lint"
# - script: make keadm_lint
# name: "keadm_lint"
# - script: make edge_lint
# name: "edge_lint"

- stage: "Test Build"
script: make
arch: amd64
name: "builds cloud and edge components on amd64"
- script: make bluetoothdevice
arch: amd64
name: "build bluetooth_device on amd64"
- script: make edge_small_build
arch: amd64
name: "build small edge version on amd64"
- script: make edge_cross_build
name: "cross build edge"
- script: make edge_cross_build_v7
name: "cross build edge for armv7"
- script: make edgesite_cross_build
name: "cross build edgesite"
- script: make edgesite_cross_build_v7
name: "cross build edgeite for armv7"
# - stage: "Test Build"
# script: make
# arch: amd64
# name: "builds cloud and edge components on amd64"
# - script: make bluetoothdevice
# arch: amd64
# name: "build bluetooth_device on amd64"
# - script: make edge_small_build
# arch: amd64
# name: "build small edge version on amd64"
# - script: make edge_cross_build
# name: "cross build edge"
# - script: make edge_cross_build_v7
# name: "cross build edge for armv7"
# - script: make edgesite_cross_build
# name: "cross build edgesite"
# - script: make edgesite_cross_build_v7
# name: "cross build edgeite for armv7"

- stage: "unit tests"
script: make edge_test
arch: amd64
name: "unit test edge on amd64"
- script: make edge_integration_test
arch: amd64
name: "integration test edgeo on amd64"
- script: make cloud_test
arch: amd64
name: "unit test cloud on amd64"

- stage: "e2e tests"
script: make e2e_test
arch: amd64
name: "e2e_test on amd64"
- script: make edge_test
arch: arm64
name: "unit test edge on arm64"
# - script: make edge_integration_test
# arch: amd64
# name: "integration test edge on amd64"
# - script: make cloud_test
# arch: amd64
# name: "unit test cloud on amd64"

- stage: "build docker images"
script: make cloudimage
arch: amd64
name: "build cloudimage on amd64"
- script: make admissionimage
arch: amd64
name: "build admission image on amd64"
- script: make edgeimage ARCH="amd64"
arch: amd64
name: "build edge image on amd64"
- script: make edgesiteimage ARCH="amd64"
arch: amd64
name: "build edgesite image on amd64"
- script: make bluetoothdevice_image
arch: amd64
name: "build bluetoothdevice image on amd64"
# - stage: "e2e tests"
# script: make e2e_test
# arch: amd64
# name: "e2e_test on amd64"
#
# - stage: "build docker images"
# script: make cloudimage
# arch: amd64
# name: "build cloudimage on amd64"
# - script: make admissionimage
# arch: amd64
# name: "build admission image on amd64"
# - script: make edgeimage ARCH="amd64"
# arch: amd64
# name: "build edge image on amd64"
# - script: make edgesiteimage ARCH="amd64"
# arch: amd64
# name: "build edgesite image on amd64"
# - script: make bluetoothdevice_image
# arch: amd64
# name: "build bluetoothdevice image on amd64"
# TODO: When the arm support of travis becomes stable, we will uncomment these cases.
# - script: make cloudimage
# arch: arm64
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Expand Up @@ -99,7 +99,8 @@ keadm_lint:
QEMU_ARCH ?= x86_64
ARCH ?= amd64

IMAGE_TAG ?= $(shell git describe --tags)
#IMAGE_TAG ?= $(shell git describe --tags)
IMAGE_TAG ?= latest

.PHONY: cloudimage
cloudimage:
Expand All @@ -126,6 +127,7 @@ edgeimage:

.PHONY: edgesiteimage
edgesiteimage:
$(info ARCH is $(ARCH))
mkdir -p ./build/edgesite/tmp
rm -rf ./build/edgesite/tmp/*
curl -L -o ./build/edgesite/tmp/qemu-${QEMU_ARCH}-static.tar.gz https://github.com/multiarch/qemu-user-static/releases/download/v3.0.0/qemu-${QEMU_ARCH}-static.tar.gz
Expand Down
1 change: 1 addition & 0 deletions edge/Makefile
Expand Up @@ -20,6 +20,7 @@ endif
export GOARCHAIUS_CONFIG_PATH=$(CURDIR)
test:
find ${TEST_DIR} -name "*_test.go"| xargs -I{} dirname {} | uniq | xargs -I{} go test ${T} {}
#bash test.sh

# lint
.PHONY: lint
Expand Down
21 changes: 19 additions & 2 deletions edge/pkg/devicetwin/dtmanager/communicate.go
Expand Up @@ -37,13 +37,26 @@ func (cw CommWorker) Start() {
return
}
if dtMsg, isDTMessage := msg.(*dttype.DTMessage); isDTMessage {
klog.Infof("Dave!!! action is: %v", dtMsg.Action)
klog.Errorf("Dave!!! action is: %v", dtMsg.Action)
klog.Infof("Dave!!! init value is: %v", msg)
klog.Errorf("Dave!!! init value is: %v", msg)
klog.Infof("Dave!!! check the value in the map: %v", ActionCallBack[dtMsg.Action])
klog.Errorf("Dave!!! check the value in the map: %v", ActionCallBack[dtMsg.Action])
for key := range ActionCallBack {
klog.Infof("Dave!!! value in the callback: %v", key)
klog.Errorf("Dave!!! value in the callback: %v", key)
}
if fn, exist := ActionCallBack[dtMsg.Action]; exist {
klog.Errorf("Dave!!!find it: %v", fn)
_, err := fn(cw.DTContexts, dtMsg.Identity, dtMsg.Msg)
if err != nil {
klog.Error("Dave!!!function called but found a error")
klog.Errorf("CommModule deal %s event failed: %v", dtMsg.Action, err)
}
} else {
klog.Errorf("CommModule deal %s event failed, not found callback", dtMsg.Action)
klog.Error("Dave!!!cannot find it")
klog.Errorf("CommModule deal %v event failed, not found callback", dtMsg.Action)
}
}

Expand Down Expand Up @@ -81,7 +94,11 @@ func dealSendToCloud(context *dtcontext.DTContext, resource string, msg interfac
if !ok {
return nil, errors.New("msg not Message type")
}
context.ModulesContext.Send(dtcommon.HubModule, *message)
klog.Infof("Dave!!! content of message is: %v", message.GetContent())
klog.Errorf("Dave!!! content of message is: %v", message.GetContent())
klog.Infof("Dave!!! ID of message is: %v", message.GetID())
klog.Errorf("Dave!!! ID of message is: %v", message.GetID())
context.ModulesContext.Send(dtcommon.HubModule, *message) //Dave: have something wrong to set to DB?
msgID := message.GetID()
context.ConfirmMap.Store(msgID, &dttype.DTMessage{Msg: message, Action: dtcommon.SendToCloud, Type: dtcommon.CommModule})
return nil, nil
Expand Down

0 comments on commit 7b2514c

Please sign in to comment.