Skip to content

Commit f80a96d

Browse files
authored
CI: fixed the .travis parsing failure (#91)
1 parent 4037da5 commit f80a96d

File tree

6 files changed

+31
-19
lines changed

6 files changed

+31
-19
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ matrix:
2525
- env: ETCD_VER=3.2.0 GOREMAN_CONF=Procfile-single
2626
- env: ETCD_VER=3.3.0 GOREMAN_CONF=Procfile-single-enable-v2
2727
- env: ETCD_VER=3.4.0 GOREMAN_CONF=Procfile-single-enable-v2
28-
- env: ETCD_VER=3.4.0 GOREMAN_CONF=Procfile-single-enable-tls ETCD_ENABLE_TLS=TRUE
28+
- env: ETCD_VER=3.4.0 GOREMAN_CONF=Procfile-single-enable-tls ETCD_ENABLE_TLS=TRUE AUTH_ENDPOINT_V2=https://127.0.0.1:12379 ETCDCTL_EXTRA_OPTS="--insecure-transport=false --insecure-skip-tls-verify=true"
2929

3030
env:
3131
global:
@@ -60,8 +60,8 @@ script:
6060
- sleep 5
6161
- chmod +x ./t/v2/add-auth.sh
6262
- chmod +x ./t/v3/add-auth.sh
63-
- [ $ETCD_ENABLE_TLS != TRUE ] && ./t/v2/add-auth.sh
64-
- [ $ETCD_ENABLE_TLS != TRUE ] && ./t/v3/add-auth.sh
63+
- "[[ $ETCD_ENABLE_TLS != TRUE ]] && ./t/v2/add-auth.sh || true"
64+
- "[[ $ETCD_ENABLE_TLS != TRUE ]] && ./t/v3/add-auth.sh || true"
6565
- cat goreman.log
6666
- ps -ef | grep etcd
6767
- luajit -v

t/Procfile-single-enable-tls

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Use goreman to run `go get github.com/mattn/goreman`
2-
etcd0: etcd
3-
etcd1: etcd --name infra1 --listen-client-urls https://127.0.0.1:12379 --advertise-client-urls https://127.0.0.1:12379 --listen-peer-urls http://127.0.0.1:12380 --initial-advertise-peer-urls http://127.0.0.1:12380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --cert-file ./t/certs/etcd.pem --key-file ./t/certs/etcd.key
4-
etcd2: etcd --name infra2 --listen-client-urls https://127.0.0.1:22379 --advertise-client-urls https://127.0.0.1:22379 --listen-peer-urls http://127.0.0.1:22380 --initial-advertise-peer-urls http://127.0.0.1:22380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --cert-file ./t/certs/etcd.pem --key-file ./t/certs/etcd.key
5-
etcd3: etcd --name infra3 --listen-client-urls https://127.0.0.1:32379 --advertise-client-urls https://127.0.0.1:32379 --listen-peer-urls http://127.0.0.1:32380 --initial-advertise-peer-urls http://127.0.0.1:32380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --cert-file ./t/certs/etcd.pem --key-file ./t/certs/etcd.key
2+
etcd0: etcd --enable-v2
3+
etcd1: etcd --name infra1 --listen-client-urls https://127.0.0.1:12379 --advertise-client-urls https://127.0.0.1:12379 --listen-peer-urls http://127.0.0.1:12380 --initial-advertise-peer-urls http://127.0.0.1:12380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --cert-file ./t/certs/etcd.pem --key-file ./t/certs/etcd.key --enable-v2
4+
etcd2: etcd --name infra2 --listen-client-urls https://127.0.0.1:22379 --advertise-client-urls https://127.0.0.1:22379 --listen-peer-urls http://127.0.0.1:22380 --initial-advertise-peer-urls http://127.0.0.1:22380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --cert-file ./t/certs/etcd.pem --key-file ./t/certs/etcd.key --enable-v2
5+
etcd3: etcd --name infra3 --listen-client-urls https://127.0.0.1:32379 --advertise-client-urls https://127.0.0.1:32379 --listen-peer-urls http://127.0.0.1:32380 --initial-advertise-peer-urls http://127.0.0.1:32380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --cert-file ./t/certs/etcd.pem --key-file ./t/certs/etcd.key --enable-v2
66
# A learner node can be started using Procfile.learner

t/v2/add-auth.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
2-
curl -X "PUT" "${AUTH_ENDPOINT_V2}/v2/auth/users/root" -H "Content-Type: application/json; charset=utf-8" -d $"{\"user\":\"${AUTH_USER}\",\"password\":\"${AUTH_PWD}\"}"
3-
curl -X "PUT" "${AUTH_ENDPOINT_V2}/v2/auth/enable"
4-
curl -X "PUT" "${AUTH_ENDPOINT_V2}/v2/auth/roles/guest" -H "Content-Type: text/plain; charset=utf-8" -u "${AUTH_USER}:${AUTH_PWD}" -d $'{"role":"guest","revoke":{"kv":{"write": ["/*"]}}}'
2+
curl -k -X "PUT" "${AUTH_ENDPOINT_V2}/v2/auth/users/root" -H "Content-Type: application/json; charset=utf-8" -d $"{\"user\":\"${AUTH_USER}\",\"password\":\"${AUTH_PWD}\"}"
3+
curl -k -X "PUT" "${AUTH_ENDPOINT_V2}/v2/auth/enable"
4+
curl -k -X "PUT" "${AUTH_ENDPOINT_V2}/v2/auth/roles/guest" -H "Content-Type: text/plain; charset=utf-8" -u "${AUTH_USER}:${AUTH_PWD}" -d $'{"role":"guest","revoke":{"kv":{"write": ["/*"]}}}'

t/v2/cluster.t

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11

2-
use Test::Nginx::Socket::Lua 'no_plan';
2+
use Test::Nginx::Socket::Lua;
33

44
log_level('warn');
55
no_long_string();
66
repeat_each(2);
77

8+
my $enable_tls = $ENV{ETCD_ENABLE_TLS};
9+
if ($enable_tls eq "TRUE") {
10+
plan(skip_all => "skip test cases when TLS is enabled");
11+
} else {
12+
plan 'no_plan';
13+
}
14+
815
our $HttpConfig = <<'_EOC_';
916
lua_socket_log_errors off;
1017
lua_package_path 'lib/?.lua;/usr/local/share/lua/5.3/?.lua;/usr/share/lua/5.1/?.lua;;';

t/v3/add-auth.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
22
export ETCDCTL_API=3
3-
etcdctl version
4-
etcdctl --endpoints="${AUTH_ENDPOINT_V3}" user add "${AUTH_USER}:${AUTH_PWD}"
5-
etcdctl --endpoints="${AUTH_ENDPOINT_V3}" role add root
6-
etcdctl --endpoints="${AUTH_ENDPOINT_V3}" user grant-role root root
7-
etcdctl --endpoints="${AUTH_ENDPOINT_V3}" role list
8-
etcdctl --endpoints="${AUTH_ENDPOINT_V3}" user list
9-
etcdctl --endpoints="${AUTH_ENDPOINT_V3}" auth enable
3+
etcdctl version
4+
etcdctl ${ETCDCTL_EXTRA_OPTS} --endpoints="${AUTH_ENDPOINT_V3}" user add "${AUTH_USER}:${AUTH_PWD}"
5+
etcdctl ${ETCDCTL_EXTRA_OPTS} --endpoints="${AUTH_ENDPOINT_V3}" role add root
6+
etcdctl ${ETCDCTL_EXTRA_OPTS} --endpoints="${AUTH_ENDPOINT_V3}" user grant-role root root
7+
etcdctl ${ETCDCTL_EXTRA_OPTS} --endpoints="${AUTH_ENDPOINT_V3}" role list
8+
etcdctl ${ETCDCTL_EXTRA_OPTS} --endpoints="${AUTH_ENDPOINT_V3}" user list
9+
etcdctl ${ETCDCTL_EXTRA_OPTS} --endpoints="${AUTH_ENDPOINT_V3}" auth enable

t/v3/cluster.t

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ my $etcd_version = `etcd --version`;
88
if ($etcd_version =~ /^etcd Version: 2/ || $etcd_version =~ /^etcd Version: 3.1./ || $etcd_version =~ /^etcd Version: 3.2./) {
99
plan(skip_all => "etcd is too old, skip v3 protocol");
1010
} else {
11-
plan 'no_plan';
11+
my $enable_tls = $ENV{ETCD_ENABLE_TLS};
12+
if ($enable_tls eq "TRUE") {
13+
plan(skip_all => "skip test cases with auth when TLS is enabled");
14+
} else {
15+
plan 'no_plan';
16+
}
1217
}
1318

1419
our $HttpConfig = <<'_EOC_';

0 commit comments

Comments
 (0)