-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathTESTDOCKERCPU
executable file
·61 lines (54 loc) · 1.98 KB
/
TESTDOCKERCPU
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
set -e
IMAGE="${1:-cpud:latest}"
if [[ -z "${DEPLOY_ENV}" ]]; then
KEYDIR=$(mktemp -d)
ssh-keygen -N "" -f ${KEYDIR}/testkey
KEY=${KEYDIR}/testkey
fi
set +e
echo "=== Testing $IMAGE ==="
echo " -create network"
docker network create cpud-test
echo " -run cpud"
docker run -d -v $KEY:/key -v $KEY.pub:/key.pub -v /tmp:/tmp --privileged --rm --network cpud-test --name cpud $IMAGE
sleep 1
echo " -run client with localhost"
docker exec -e PWD=/ cpud /bin/cpu $DEBUG -key /key localhost /bin/date
sleep 1
echo "==== cpud server logs ===="
docker logs cpud
docker kill cpud
docker network rm cpud-test
echo "==== done ===="
echo "=== Testing DNS-SD $IMAGE with explicit hostname ==="
echo " -create network"
docker network create decpud-test
echo " -run decpud"
docker run -d -v $KEY:/key -v $KEY.pub:/key.pub -v /tmp:/tmp --privileged --rm --network decpud-test --name decpud $IMAGE /bin/decpud
sleep 5
echo " -run client with localhost"
docker exec -e PWD=/ decpud /bin/decpu $DEBUG -key /key localhost /bin/date
sleep 1
echo " -run client with discovery"
docker exec -e PWD=/ decpud /bin/decpu $DEBUG -key /key . /bin/date
sleep 1
echo " -run client with explicit discovery"
docker exec -e PWD=/ decpud /bin/decpu $DEBUG -key /key dnssd://local/_ncpu._tcp /bin/date
sleep 1
echo " -run client with meta-requirement"
docker exec -e PWD=/ decpud /bin/decpu $DEBUG -key /key dnssd://local/_ncpu._tcp?tenants=0 /bin/date
sleep 1
echo " -run client with sort"
docker exec -e PWD=/ decpud /bin/decpu $DEBUG -key /key dnssd://local/_ncpu._tcp?sort=cpu.pcnt /bin/date
sleep 1
echo " -run client with requirement and sort "
docker exec -e PWD=/ decpud /bin/decpu $DEBUG -key /key dnssd://local/_ncpu._tcp?tenants=0\&sort=cpu.pcnt /bin/date
sleep 1
echo " -run client with shortened sort "
docker exec -e PWD=/ decpud /bin/decpu $DEBUG -key /key dnssd://?sort=cpu.pcnt /bin/date
sleep 1
echo "==== DNS-SD decpud server logs ====="
docker logs decpud
docker kill decpud
docker network rm decpud-test