minishift / minishift-b2d-iso

ISO based on Boot2Docker for Minishift
Apache License 2.0
9 stars 13 forks source link

Issue #73 Replace avocado based tests with shell script based #74

Closed coolbrg closed 6 years ago

coolbrg commented 6 years ago

Fix #73

coolbrg commented 6 years ago

cc @LalatenduMohanty

coolbrg commented 6 years ago

retest this please

coolbrg commented 6 years ago

@LalatenduMohanty , Updated the PR after fix of 'Issue #70 move the minishift binary to $(BIN_DIR) after extracting'

LalatenduMohanty commented 6 years ago

When I tested the PR it failed for me on fedora 25.

$ minishift delete
You are deleting the Minishift VM: 'minishift'. Do you want to continue [y/N]?: y
Deleting the Minishift VM...
Minishift VM deleted.
[lmohanty@LalatenduM-laptop minishift-b2d-iso]$ make test
sh tests/test.sh
-- Checking if KVM driver is installed ... 
   Driver is available at /usr/local/bin/docker-machine-driver-kvm ... 
   Checking driver binary is executable ... OK
-- Checking if Libvirt is installed ... OK
-- Checking if Libvirt default network is present and active ... OK
-- Starting local OpenShift cluster using 'kvm' hypervisor ...
-- Minishift VM will be configured with ...
   Memory:    2 GB
   vCPUs :    2
   Disk size: 20 GB
-- Starting Minishift VM ....(minishift) Trying to access option swarm-master which does not exist
(minishift) THIS ***WILL*** CAUSE UNEXPECTED BEHAVIOR
(minishift) Type assertion did not go smoothly to bool for key swarm-master
(minishift) Trying to access option swarm-host which does not exist
(minishift) THIS ***WILL*** CAUSE UNEXPECTED BEHAVIOR
(minishift) Type assertion did not go smoothly to string for key swarm-host
(minishift) Trying to access option swarm-discovery which does not exist
(minishift) THIS ***WILL*** CAUSE UNEXPECTED BEHAVIOR
(minishift) Type assertion did not go smoothly to string for key swarm-discovery
Running pre-create checks...
Creating machine...
(minishift) Downloading /home/lmohanty/.minishift/cache/boot2docker.iso from file:///home/lmohanty/GoCode/src/github.com/minishift/minishift-b2d-iso/build/minishift-b2d.iso...
...............Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
...Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
.Checking connection to Docker...
Docker is up and running!
 OK
-- Checking for IP address ... OK
-- Checking if external host is reachable from the Minishift VM ... 
   Pinging 8.8.8.8 ... OK
-- Checking HTTP connectivity from the VM ... 
   Retrieving http://minishift.io/index.html ... OK
-- Checking if persistent storage volume is mounted ... OK
-- Checking available disk space ... 0% used OK
-- OpenShift cluster will be configured with ...
   Version: v3.6.0
-- Checking `oc` support for startup flags ... 
   host-data-dir ... OK
   host-pv-dir ... OK
   host-volumes-dir ... OK
   routing-suffix ... OK
   host-config-dir ... OK
Starting OpenShift using openshift/origin:v3.6.0 ...
Pulling image openshift/origin:v3.6.0
Pulled 1/4 layers, 26% complete
Pulled 1/4 layers, 44% complete
Pulled 1/4 layers, 61% complete
Pulled 1/4 layers, 78% complete
Pulled 2/4 layers, 82% complete
Pulled 3/4 layers, 87% complete
Pulled 3/4 layers, 99% complete
Pulled 4/4 layers, 100% complete
Extracting
Image pull complete
OpenShift server started.

The server is accessible via web console at:
    https://192.168.42.53:8443

You are logged in as:
    User:     developer
    Password: <any value>

To login as administrator:
    oc login -u system:admin

 ------------ [ Starting VM - Passed ]

 ------------ [ SSH Connection - Passed ]

 ------------ [ Getting VM IP - Passed ]

 ------------ [ CIFS installation - Passed ]

FUSE library version: 2.9.3
using FUSE kernel interface version 7.19

 ------------ [ SSHFS installation - Passed ]

 ------------ [ NFS installation - Passed ]

Expected '2' equal to '5'
Makefile:52: recipe for target 'test' failed
make: *** [test] Error 1
LalatenduMohanty commented 6 years ago

In the VM I am seeing

$ mount | grep /dev/sda1 | grep /var/lib/
/dev/sda1 on /mnt/sda1/var/lib/docker/aufs type ext4 (rw,relatime,data=ordered)
/dev/sda1 on /mnt/sda1/var/lib/minishift/openshift.local.volumes type ext4 (rw,relatime,data=ordered)
gbraad commented 6 years ago

Expected ' ' but got ' '

 ------------ [ NFS installation - Passed ]

Expected '2' equal to '5'

was 2 the value you received... or was it 5? when using "Expected '2', but got '5' is clearer in meaning.

 ------------ [ NFS installation - Failed ]

Expected '2' but got '5'
LalatenduMohanty commented 6 years ago

This PR can not be tested on macOS as we only download minishift Linux binary

tests/utils/minishift_latest_version.py

#!/usr/bin/env python
  2
  3 import requests
  4 import re
  5 import os
  6
  7 OS = os.getenv('OS', 'linux')
  8
  9 def main():
 10     pattern = re.compile(".*%s-amd64.(tgz|zip)$" % OS)
 11     r = requests.get('https://api.github.com/repos/minishift/minishift/releases/latest')
 12     for asset in r.json()['assets']:
 13         if pattern.match(asset['name']):
 14             print asset['browser_download_url']
 15
 16 if __name__ == "__main__":
 17     main()
coolbrg commented 6 years ago

This PR can not be tested on macOS as we only download minishift Linux binary

@LalatenduMohanty Created issue https://github.com/minishift/minishift-b2d-iso/issues/77 to fix it as it is not related to this PR.

LalatenduMohanty commented 6 years ago

I ran this PR on macOS with the help of #78. But it still failed with same error.

$ make test
sh tests/test.sh
-- Checking if requested hypervisor 'xhyve' is supported on this platform ... OK
-- Checking if xhyve driver is installed ...
   Driver is available at /usr/local/bin/docker-machine-driver-xhyve
   Checking for setuid bit ... OK
-- Checking the ISO URL ...
   Checking if /Users/lmohanty/code/gocode/src/github.com/minishift/minishift-b2d-iso/build/minishift-b2d.iso exists ... OK
-- Starting local OpenShift cluster using 'xhyve' hypervisor ...
-- Minishift VM will be configured with ...
   Memory:    2 GB
   vCPUs :    2
   Disk size: 20 GB
-- Starting Minishift VM ....(minishift) Type assertion did not go smoothly to bool for key xhyve-experimental-nfs-share
(minishift) Type assertion did not go smoothly to bool for key xhyve-qcow2
(minishift) Trying to access option swarm-discovery which does not exist
(minishift) THIS ***WILL*** CAUSE UNEXPECTED BEHAVIOR
(minishift) Type assertion did not go smoothly to string for key swarm-discovery
(minishift) Trying to access option swarm-host which does not exist
(minishift) THIS ***WILL*** CAUSE UNEXPECTED BEHAVIOR
(minishift) Type assertion did not go smoothly to string for key swarm-host
(minishift) Trying to access option swarm-master which does not exist
(minishift) THIS ***WILL*** CAUSE UNEXPECTED BEHAVIOR
(minishift) Type assertion did not go smoothly to bool for key swarm-master
(minishift) Type assertion did not go smoothly to bool for key xhyve-virtio-9p
Running pre-create checks...
Creating machine...
(minishift) Downloading /Users/lmohanty/.minishift/cache/boot2docker.iso from file:///Users/lmohanty/code/gocode/src/github.com/minishift/minishift-b2d-iso/build/minishift-b2d.iso...
(minishift) Creating VM...
(minishift) /dev/disk34                                             /Users/lmohanty/.minishift/machines/minishift/b2d-image
(minishift) "disk34" unmounted.
(minishift) "disk34" ejected.
(minishift) Generating 20000MB disk image...
.(minishift) created: /Users/lmohanty/.minishift/machines/minishift/root-volume.sparsebundle
.(minishift) Creating SSH key...
(minishift) Fix file permission...
(minishift) Generate UUID...
(minishift) Convert UUID to MAC address...
(minishift) Starting minishift...
.(minishift) Waiting for VM to come online...
(minishift) Waiting on a pseudo-terminal to be ready... done
(minishift) Hook up your terminal emulator to /dev/ttys007 in order to connect to your VM
...........Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
..Copying certs to the local machine directory...
.Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
 OK
-- Checking for IP address ... OK
-- Checking if external host is reachable from the Minishift VM ...
   Pinging 8.8.8.8 ... OK
-- Checking HTTP connectivity from the VM ...
   Retrieving http://minishift.io/index.html ... OK
-- Checking if persistent storage volume is mounted ... OK
-- Checking available disk space ... 0% used OK
-- OpenShift cluster will be configured with ...
   Version: v3.6.0
-- Checking `oc` support for startup flags ...
   host-data-dir ... OK
   host-pv-dir ... OK
   host-volumes-dir ... OK
   routing-suffix ... OK
   host-config-dir ... OK
Starting OpenShift using openshift/origin:v3.6.0 ...
Pulling image openshift/origin:v3.6.0
Pulled 1/4 layers, 26% complete
Pulled 1/4 layers, 43% complete
Pulled 1/4 layers, 60% complete
Pulled 1/4 layers, 77% complete
Pulled 2/4 layers, 83% complete
Pulled 3/4 layers, 89% complete
Pulled 4/4 layers, 100% complete
Extracting
Image pull complete
OpenShift server started.

The server is accessible via web console at:
    https://192.168.64.136:8443

You are logged in as:
    User:     developer
    Password: <any value>

To login as administrator:
    oc login -u system:admin

 ------------ [ Starting VM - Passed ]

 ------------ [ SSH Connection - Passed ]

 ------------ [ Getting VM IP - Passed ]

 ------------ [ CIFS installation - Passed ]

FUSE library version: 2.9.3
using FUSE kernel interface version 7.19

 ------------ [ SSHFS installation - Passed ]

 ------------ [ NFS installation - Passed ]

Expected '5' but got '2'
make: *** [test] Error 1
coolbrg commented 6 years ago

Expected '5' but got '2' make: *** [test] Error 1

Not sure why you are getting it. We usually get 5. /cc @gbraad

coolbrg commented 6 years ago

@LalatenduMohanty , What are you getting here https://github.com/minishift/minishift-b2d-iso/blob/7f9222e0ee997d38e495006d0826a0ab2c3f099f/tests/test.py#L81-L83 while testing #78

anjannath commented 6 years ago

All tests passed for me 👍

➜  minishift-b2d-iso git:(pr-74) ✗ make test
Downloading latest minishift binary at /home/anath/RH/minishift-b2d-iso/build/bin/minishift...
######################################################################## 100.0%
Done.
sh tests/test.sh
-- Checking if requested hypervisor 'kvm' is supported on this platform ... OK
.....

The server is accessible via web console at:
    https://192.168.42.172:8443

 ------------ [ Starting VM - Passed ]

 ------------ [ SSH Connection - Passed ]

 ------------ [ Getting VM IP - Passed ]

 ------------ [ CIFS installation - Passed ]

FUSE library version: 2.9.3
using FUSE kernel interface version 7.19

 ------------ [ SSHFS installation - Passed ]

 ------------ [ NFS installation - Passed ]

 ------------ [ Bind mount check - Passed ]

Stopping local OpenShift cluster...
Cluster stopped.

 ------------ [ Stopping VM - Passed ]

Deleting the Minishift VM...
Minishift VM deleted.
LalatenduMohanty commented 6 years ago

@praveenkumar @gbraad Can you guys confirm that it works for you?

praveenkumar commented 6 years ago

@LalatenduMohanty @budhrg tested on fedora and works as expected.

$ make test
[...]
You are logged in as:
    User:     developer
    Password: <any value>

To login as administrator:
    oc login -u system:admin

 ------------ [ Starting VM - Passed ]

 ------------ [ SSH Connection - Passed ]

 ------------ [ Getting VM IP - Passed ]

 ------------ [ CIFS installation - Passed ]

FUSE library version: 2.9.3
using FUSE kernel interface version 7.19

 ------------ [ SSHFS installation - Passed ]

 ------------ [ NFS installation - Passed ]

 ------------ [ Bind mount check - Passed ]

Stopping local OpenShift cluster...
Cluster stopped.

 ------------ [ Stopping VM - Passed ]

Deleting the Minishift VM...
Minishift VM deleted.