Skip to content

Commit

Permalink
update test settings so we can test fx64/65 only on TabManager
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronmi committed Mar 7, 2019
1 parent ea4415d commit 63b219a
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 44 deletions.
4 changes: 2 additions & 2 deletions .drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ local TestTabmgrStep(go, fx) = {
FX_VER: fx,
},
commands: [
"run-test.sh go test -p 2 -bench ./tabmgr -benchmem -cover",
"run-test.sh go test -p 2 -run TestTabManager -cover ./tabmgr",
],
volumes: [
{name: "opt", path: "/opt"},
],
};

local TestCmd(dir) = [
"run-test.sh go test -p 2 -bench ./"+dir+" -benchmem -cover",
"run-test.sh go test -p 2 -bench . -benchmem -cover ./"+dir,
];

local TestStep(go, fx) = {
Expand Down
60 changes: 30 additions & 30 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ steps:
- name: test-go1.10.8-fx66.0b9
image: ronmi/go-firefox
commands:
- run-test.sh go test -p 2 -bench ./. -benchmem -cover
- run-test.sh go test -p 2 -bench ./mnsender -benchmem -cover
- run-test.sh go test -p 2 -bench ./mnclient -benchmem -cover
- run-test.sh go test -p 2 -bench ./tabmgr -benchmem -cover
- run-test.sh go test -p 2 -bench . -benchmem -cover ./.
- run-test.sh go test -p 2 -bench . -benchmem -cover ./mnsender
- run-test.sh go test -p 2 -bench . -benchmem -cover ./mnclient
- run-test.sh go test -p 2 -bench . -benchmem -cover ./tabmgr
environment:
FX_VER: 66.0b9
GO_VER: 1.10.8
Expand All @@ -28,10 +28,10 @@ steps:
- name: test-go1.10.8-fx66.0b12
image: ronmi/go-firefox
commands:
- run-test.sh go test -p 2 -bench ./. -benchmem -cover
- run-test.sh go test -p 2 -bench ./mnsender -benchmem -cover
- run-test.sh go test -p 2 -bench ./mnclient -benchmem -cover
- run-test.sh go test -p 2 -bench ./tabmgr -benchmem -cover
- run-test.sh go test -p 2 -bench . -benchmem -cover ./.
- run-test.sh go test -p 2 -bench . -benchmem -cover ./mnsender
- run-test.sh go test -p 2 -bench . -benchmem -cover ./mnclient
- run-test.sh go test -p 2 -bench . -benchmem -cover ./tabmgr
environment:
FX_VER: 66.0b12
GO_VER: 1.10.8
Expand All @@ -42,10 +42,10 @@ steps:
- name: test-go1.11.5-fx66.0b9
image: ronmi/go-firefox
commands:
- run-test.sh go test -p 2 -bench ./. -benchmem -cover
- run-test.sh go test -p 2 -bench ./mnsender -benchmem -cover
- run-test.sh go test -p 2 -bench ./mnclient -benchmem -cover
- run-test.sh go test -p 2 -bench ./tabmgr -benchmem -cover
- run-test.sh go test -p 2 -bench . -benchmem -cover ./.
- run-test.sh go test -p 2 -bench . -benchmem -cover ./mnsender
- run-test.sh go test -p 2 -bench . -benchmem -cover ./mnclient
- run-test.sh go test -p 2 -bench . -benchmem -cover ./tabmgr
environment:
FX_VER: 66.0b9
GO_VER: 1.11.5
Expand All @@ -56,10 +56,10 @@ steps:
- name: test-go1.11.5-fx66.0b12
image: ronmi/go-firefox
commands:
- run-test.sh go test -p 2 -bench ./. -benchmem -cover
- run-test.sh go test -p 2 -bench ./mnsender -benchmem -cover
- run-test.sh go test -p 2 -bench ./mnclient -benchmem -cover
- run-test.sh go test -p 2 -bench ./tabmgr -benchmem -cover
- run-test.sh go test -p 2 -bench . -benchmem -cover ./.
- run-test.sh go test -p 2 -bench . -benchmem -cover ./mnsender
- run-test.sh go test -p 2 -bench . -benchmem -cover ./mnclient
- run-test.sh go test -p 2 -bench . -benchmem -cover ./tabmgr
environment:
FX_VER: 66.0b12
GO_VER: 1.11.5
Expand All @@ -70,10 +70,10 @@ steps:
- name: test-go1.12-fx66.0b9
image: ronmi/go-firefox
commands:
- run-test.sh go test -p 2 -bench ./. -benchmem -cover
- run-test.sh go test -p 2 -bench ./mnsender -benchmem -cover
- run-test.sh go test -p 2 -bench ./mnclient -benchmem -cover
- run-test.sh go test -p 2 -bench ./tabmgr -benchmem -cover
- run-test.sh go test -p 2 -bench . -benchmem -cover ./.
- run-test.sh go test -p 2 -bench . -benchmem -cover ./mnsender
- run-test.sh go test -p 2 -bench . -benchmem -cover ./mnclient
- run-test.sh go test -p 2 -bench . -benchmem -cover ./tabmgr
environment:
FX_VER: 66.0b9
GO_VER: 1.12
Expand All @@ -84,10 +84,10 @@ steps:
- name: test-go1.12-fx66.0b12
image: ronmi/go-firefox
commands:
- run-test.sh go test -p 2 -bench ./. -benchmem -cover
- run-test.sh go test -p 2 -bench ./mnsender -benchmem -cover
- run-test.sh go test -p 2 -bench ./mnclient -benchmem -cover
- run-test.sh go test -p 2 -bench ./tabmgr -benchmem -cover
- run-test.sh go test -p 2 -bench . -benchmem -cover ./.
- run-test.sh go test -p 2 -bench . -benchmem -cover ./mnsender
- run-test.sh go test -p 2 -bench . -benchmem -cover ./mnclient
- run-test.sh go test -p 2 -bench . -benchmem -cover ./tabmgr
environment:
FX_VER: 66.0b12
GO_VER: 1.12
Expand All @@ -98,7 +98,7 @@ steps:
- name: test-tabmgr-go1.10.8-fx64.0
image: ronmi/go-firefox
commands:
- run-test.sh go test -p 2 -bench ./tabmgr -benchmem -cover
- run-test.sh go test -p 2 -run TestTabManager -cover ./tabmgr
environment:
FX_VER: 64.0
GO_VER: 1.10.8
Expand All @@ -109,7 +109,7 @@ steps:
- name: test-tabmgr-go1.10.8-fx65.0
image: ronmi/go-firefox
commands:
- run-test.sh go test -p 2 -bench ./tabmgr -benchmem -cover
- run-test.sh go test -p 2 -run TestTabManager -cover ./tabmgr
environment:
FX_VER: 65.0
GO_VER: 1.10.8
Expand All @@ -120,7 +120,7 @@ steps:
- name: test-tabmgr-go1.11.5-fx64.0
image: ronmi/go-firefox
commands:
- run-test.sh go test -p 2 -bench ./tabmgr -benchmem -cover
- run-test.sh go test -p 2 -run TestTabManager -cover ./tabmgr
environment:
FX_VER: 64.0
GO_VER: 1.11.5
Expand All @@ -131,7 +131,7 @@ steps:
- name: test-tabmgr-go1.11.5-fx65.0
image: ronmi/go-firefox
commands:
- run-test.sh go test -p 2 -bench ./tabmgr -benchmem -cover
- run-test.sh go test -p 2 -run TestTabManager -cover ./tabmgr
environment:
FX_VER: 65.0
GO_VER: 1.11.5
Expand All @@ -142,7 +142,7 @@ steps:
- name: test-tabmgr-go1.12-fx64.0
image: ronmi/go-firefox
commands:
- run-test.sh go test -p 2 -bench ./tabmgr -benchmem -cover
- run-test.sh go test -p 2 -run TestTabManager -cover ./tabmgr
environment:
FX_VER: 64.0
GO_VER: 1.12
Expand All @@ -153,7 +153,7 @@ steps:
- name: test-tabmgr-go1.12-fx65.0
image: ronmi/go-firefox
commands:
- run-test.sh go test -p 2 -bench ./tabmgr -benchmem -cover
- run-test.sh go test -p 2 -run TestTabManager -cover ./tabmgr
environment:
FX_VER: 65.0
GO_VER: 1.12
Expand Down
32 changes: 26 additions & 6 deletions dev-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,33 @@ function runtest {
echo ''
echo ''
echo "Test ${3} against Go ${1} Firefox ${2}"
docker run -it --rm \
GOV="$1"
FXV="$2"
PKG="$3"
shift; shift; shift
docker run --rm \
-v "$(pwd):${DIR}" \
-v "$(pwd)/.cache/opt:/opt" \
-v "$(pwd)/.cache:/home/user" \
-e "HOME=/home/user" \
-e "GO_VER=${1}" \
-e "FX_VER=${2}" \
-e "GO_VER=${GOV}" \
-e "FX_VER=${FXV}" \
--workdir "$DIR" \
--user "${UID}:${GID}" \
ronmi/go-firefox \
go test -p 2 -bench . -benchmem "$3"
go test -p 2 -bench . -benchmem "$PKG" "$@"
}

CNT=0

function jobc {
CNT=$((CNT+1))

if [[ $CNT -ge 3 ]]
then
wait
CNT=0
fi
}

set -e
Expand All @@ -27,7 +43,8 @@ do
do
for pkg in . ./mnsender ./mnclient ./tabmgr
do
runtest $go $fx $pkg
runtest $go $fx $pkg &
jobc
done
done
done
Expand All @@ -37,6 +54,9 @@ do
for fx in 64.0 65.0
do
echo "Test tabmgr against Go ${go} Firefox ${fx}"
runtest $go $fx ./tabmgr
runtest $go $fx ./tabmgr -run TestTabManager &
jobc
done
done

wait
23 changes: 17 additions & 6 deletions tabmgr/tabmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,18 @@ func connect(t *testing.T) (m mnsender.Sender, c *mnclient.Commander) {
return
}

func TestInit(t *testing.T) {
func TestTabManager(t *testing.T) {
t.Run("Init", testInit)
t.Run("Ordered", testOrdered)
t.Run("Intersect", testIntersect)
t.Run("Concurrent", testConcurrent)
t.Run("WaitFor", func(t *testing.T) {
t.Run("OK", testWaitForOK)
t.Run("Fail", testWaitForFail)
})
}

func testInit(t *testing.T) {
sender, client := connect(t)
defer sender.Close()

Expand All @@ -71,7 +82,7 @@ func TestInit(t *testing.T) {
}
}

func TestOrdered(t *testing.T) {
func testOrdered(t *testing.T) {
sender, _ := connect(t)
defer sender.Close()
lbl := []string{"a", "b", "c", "d", "e"}
Expand Down Expand Up @@ -102,7 +113,7 @@ func TestOrdered(t *testing.T) {
}
}

func TestIntersect(t *testing.T) {
func testIntersect(t *testing.T) {
sender, _ := connect(t)
defer sender.Close()
lbl := []string{"a", "b", "c", "d", "e"}
Expand Down Expand Up @@ -132,7 +143,7 @@ func TestIntersect(t *testing.T) {
}
}

func TestConcurrent(t *testing.T) {
func testConcurrent(t *testing.T) {
sender, _ := connect(t)
defer sender.Close()
lbl := []string{"a", "b", "c", "d", "e"}
Expand Down Expand Up @@ -180,7 +191,7 @@ func TestConcurrent(t *testing.T) {
})
}

func TestWaitForOK(t *testing.T) {
func testWaitForOK(t *testing.T) {
sender, _ := connect(t)
defer sender.Close()
lbl := []string{"a", "b", "c", "d", "e"}
Expand All @@ -207,7 +218,7 @@ func TestWaitForOK(t *testing.T) {
}
}

func TestWaitForFail(t *testing.T) {
func testWaitForFail(t *testing.T) {
sender, _ := connect(t)
defer sender.Close()
lbl := []string{"a", "b", "c", "d", "e"}
Expand Down

0 comments on commit 63b219a

Please sign in to comment.