Merge "Update example builds to test in RPM verify jobs"
[releng/builder.git] / jjb / packaging / test-karaf-oxygensafe.expect
1 #!/usr/bin/expect
2 # This script starts the Karaf shell and sends the password for SSH auth.
3 # Further tests in Karaf shell can be done here
4
5 # Echo commands
6 log_user 1
7
8 # Time expect will wait for output
9 set timeout 30
10
11 # Default password
12 set password "karaf"
13 # Default prompt
14 set prompt "opendaylight-user@root>"
15
16 # Wait for Karaf SSH server to come online
17 send_user "Waiting on OpenDaylight to start listening for SSH on port 8101\n"
18 exec bash -c "while ! nmap -Pn -p8101 localhost | grep -q open; do sleep 0.1; done"
19
20 # SSH into Karaf shell
21 spawn ssh -p 8101 -o StrictHostKeyChecking=no karaf@127.0.0.1
22
23 # Auth to Karaf shell
24 expect "Password authentication"
25 expect "Password: "
26 send "$password\r"
27
28 # Show features to make debugging easier
29 expect "$prompt"
30 send "feature:list\r"
31
32 # Verify that a major feature is present
33 expect "$prompt"
34 send "feature:list | grep odl-netvirt-openstack\r"
35 expect {{
36   timeout {{
37     send_user "\nTest feature not found\n"
38     exit 1
39   }}
40   "OpenDaylight :: NetVirt :: OpenStack" {{
41     send_user "\nTest feature available\n"
42   }}
43 }}
44
45 # Disable this test until ODLPARENT-139 is fixed
46 # Install feature
47 # expect "$prompt"
48 # send "feature:install odl-netvirt-openstack\r"
49 # expect {{
50 #   "Error executing command: Can't install feature" {{
51 #     send_user "\nFailed to install test feature\n"
52 #     exit 1
53 #   }}
54 # }}
55
56 # Verify installed feature is actually installed
57 # expect "$prompt"
58 # The -i flag will only show installed features
59 # send "feature:list -i | grep odl-netvirt-openstack\r"
60 # expect {{
61 #   timeout {{
62 #     send_user "\nTest feature not installed\n"
63 #     exit 1
64 #   }}
65 #   "OpenDaylight :: NetVirt :: OpenStack" {{
66 #     send_user "\nTest feature installed successfully\n"
67 #   }}
68 # }}