Skip to content

Commit 6428875

Browse files
rm sudo when test bootstrap
1 parent 9c11be7 commit 6428875

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

bootstrap_test/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ ipaddr:
1212
client:
1313
appname: ipaddr-client
1414
procname: web
15-
num_instances: 4
15+
num_instances: 2

bootstrap_test/conftest.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,41 @@
1010

1111
@pytest.fixture(scope="session")
1212
def up_node1():
13-
subproc.check_call(['sudo', 'vagrant', 'destroy', '-f', 'node1'])
14-
subproc.check_call(['sudo', 'vagrant', 'up', 'node1'])
13+
subproc.check_call(['vagrant', 'destroy', '-f', 'node1'])
14+
subproc.check_call(['vagrant', 'up', 'node1'])
1515
yield "node1 is ready"
1616

1717
print("Destroying node1...")
18-
subproc.call(['sudo', 'vagrant', 'destroy', '-f', 'node1'])
18+
subproc.call(['vagrant', 'destroy', '-f', 'node1'])
1919
print("Node1 is destroyed.")
2020

2121

2222
@pytest.fixture(scope="session")
2323
def up_node2():
24-
subproc.check_call(['sudo', 'vagrant', 'destroy', '-f', 'node2'])
25-
subproc.check_call(['sudo', 'vagrant', 'up', 'node2'])
24+
subproc.check_call(['vagrant', 'destroy', '-f', 'node2'])
25+
subproc.check_call(['vagrant', 'up', 'node2'])
2626
yield "node2 is ready"
2727

2828
print("Destroying node2...")
29-
subproc.call(['sudo', 'vagrant', 'destroy', '-f', 'node2'])
29+
subproc.call(['vagrant', 'destroy', '-f', 'node2'])
3030
print("Node2 is destroyed.")
3131

3232

3333
@pytest.fixture(scope="session")
3434
def up_node3():
35-
subproc.check_call(['sudo', 'vagrant', 'destroy', '-f', 'node3'])
36-
subproc.check_call(['sudo', 'vagrant', 'up', 'node3'])
35+
subproc.check_call(['vagrant', 'destroy', '-f', 'node3'])
36+
subproc.check_call(['vagrant', 'up', 'node3'])
3737
yield "node3 is ready"
3838

3939
print("Destroying node3...")
40-
subproc.call(['sudo', 'vagrant', 'destroy', '-f', 'node3'])
40+
subproc.call(['vagrant', 'destroy', '-f', 'node3'])
4141
print("Node3 is destroyed.")
4242

4343

4444
@pytest.fixture(scope="session")
4545
def bootstrap(up_node1):
4646
subproc.check_call([
47-
'sudo', 'vagrant', 'ssh', 'node1', '-c',
47+
'vagrant', 'ssh', 'node1', '-c',
4848
'sudo /vagrant/bootstrap -m https://l2ohopf9.mirror.aliyuncs.com -r docker.io/laincloud --vip={}'.
4949
format(CONFIG.vip)
5050
])
@@ -53,7 +53,7 @@ def bootstrap(up_node1):
5353
@pytest.fixture(scope="session")
5454
def prepare_demo_images(bootstrap):
5555
subproc.check_call([
56-
'sudo', 'vagrant', 'ssh', 'node1', '-c',
56+
'vagrant', 'ssh', 'node1', '-c',
5757
'sudo sh /vagrant/bootstrap_test/prepare_demo_images.sh'
5858
])
5959

@@ -78,12 +78,12 @@ def deploy_ipaddr(reposit_ipaddr):
7878
@pytest.fixture(scope="session")
7979
def add_node(bootstrap, up_node2, up_node3):
8080
subproc.check_call([
81-
'sudo', 'vagrant', 'ssh', 'node1', '-c',
81+
'vagrant', 'ssh', 'node1', '-c',
8282
'cd /vagrant/bootstrap_test && sudo ansible-playbook \
8383
-i host_vars/test-nodes distribute_ssh_key.yaml'
8484
])
8585
subproc.check_call([
86-
'sudo', 'vagrant', 'ssh', 'node1', '-c',
86+
'vagrant', 'ssh', 'node1', '-c',
8787
'sudo lainctl node add -p /vagrant/playbooks node2:192.168.77.22 ' +
8888
'node3:192.168.77.23'
8989
])
@@ -93,4 +93,4 @@ def add_node(bootstrap, up_node2, up_node3):
9393
def scale_ipaddr_client(deploy_ipaddr, add_node):
9494
app_ctl.scale(CONFIG.ipaddr_client_appname, CONFIG.ipaddr_client_procname,
9595
CONFIG.ipaddr_client_num_instances)
96-
time.sleep(60)
96+
time.sleep(120)

0 commit comments

Comments
 (0)