Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

Validate instance creation for Virtualbox using driver flags #843

Closed
crosbymichael opened this issue Mar 23, 2015 · 12 comments
Closed

Validate instance creation for Virtualbox using driver flags #843

crosbymichael opened this issue Mar 23, 2015 · 12 comments

Comments

@crosbymichael
Copy link

Problem

Test the flags for VirtualBox

Solution

Validate instance creation using various flags for VirtualBox

There are several flags available for each driver. Test each flag to ensure it does the intended behavior.

For example,

docker-machine create -d virtualbox --virtualbox-memory "1024" test-vbox

This should create a machine in virtualbox with 1024 MB of memory.

@slashk
Copy link
Contributor

slashk commented Mar 23, 2015

@crosbymichael just to be clear, you'd like to see additional integration tests for the virtualbox driver -- ideally in test/integration/driver-virtualbox.bats ?

If so, I have some of these tests written that I can contribute:

  • correct default memory size
  • correct default disk size
  • create should fail with too small disk flag
  • create should fail with too small memory flag
  • create should fail with malformed boot2docker url

Are there other tests that you are looking for ?

@ehazlett
Copy link
Contributor

@slashk sorry i wasn't clear. this is to test the creation of the machine for specific flags. however, integrations +1 :D

@tombee
Copy link
Contributor

tombee commented Mar 25, 2015

Test Environment

Mac OS Yosemite and VirtualBox 4.3.20

$ docker-machine -v
docker-machine version 0.2.0 (5575c6d)

Documentation and Flags

The flags available for configuring the VirtualBox driver are:

   --virtualbox-boot2docker-url     The URL of the boot2docker image. Defaults to the latest available version [$VIRTUALBOX_BOOT2DOCKER_URL]
   --virtualbox-disk-size "20000"   Size of disk for host in MB
   --virtualbox-memory "1024"       Size of memory for host in MB

@ehazlett Are we missing environment variables for $VIRTUALBOX_DISK_SIZE and $VIRTUALBOX_MEMORY?

1. Can create a VirtualBox host with default boot2docker URL, 10000MB disk size and 512MB memory

I'm finding it just hangs here:

$ docker-machine create -d virtualbox --virtualbox-disk-size "10000" --virtualbox-memory "512" virtualbox-test-default
INFO[0000] Creating SSH key...
INFO[0001] Creating VirtualBox VM...
INFO[0004] Starting VirtualBox VM...

@slashk
Copy link
Contributor

slashk commented Mar 25, 2015

@tombee @ehazlett pull request #873 adds integration tests that exercises @tombee scenario above

@ehazlett
Copy link
Contributor

@slashk thanks!

@tombee yes i think those would be good to have (env vars). would you mind submitting a PR? thanks!

@tombee
Copy link
Contributor

tombee commented Mar 25, 2015

@ehazlett I'd be glad to, thanks for that.

I'll resume the validation once there's a fix for the issue @slashk and I have ran into 😃

@ehazlett
Copy link
Contributor

@tombee thanks!

@tombee
Copy link
Contributor

tombee commented Mar 25, 2015

OK.. tried again after rebooting, seems I just had some spurious VirtualBox issues

Test Environment

Mac OS Yosemite and VirtualBox 4.3.20

$ docker-machine -v
docker-machine version 0.2.0 (5575c6d)

Documentation and Flags

The flags available for configuring the VirtualBox driver are:

   --virtualbox-boot2docker-url     The URL of the boot2docker image. Defaults to the latest available version [$VIRTUALBOX_BOOT2DOCKER_URL]
   --virtualbox-disk-size "20000"   Size of disk for host in MB
   --virtualbox-memory "1024"       Size of memory for host in MB

[:large_blue_circle: PASS] 1. Can create a VirtualBox host with default boot2docker URL, 10000MB disk size and 512MB memory

$ docker-machine create -d virtualbox --virtualbox-disk-size "10000" --virtualbox-memory "512" virtualbox-test-default
INFO[0000] Creating SSH key...
INFO[0001] Creating VirtualBox VM...
INFO[0004] Starting VirtualBox VM...
INFO[0005] Waiting for VM to start...
INFO[0037] "virtualbox-test-default" has been created and is now the active machine.
INFO[0037] To point your Docker client at it, run this in your shell: eval "$(docker-machine env virtualbox-test-default)"

$ docker-machine inspect virtualbox-test-default
{
    "DriverName": "virtualbox",
    "Driver": {
        "MachineName": "virtualbox-test-default",
        "SSHUser": "docker",
        "SSHPort": 49287,
        "Memory": 512,
        "DiskSize": 10000,
        "Boot2DockerURL": "",
        "CaCertPath": "/Users/tbarlow/.docker/machine/certs/ca.pem",
        "PrivateKeyPath": "/Users/tbarlow/.docker/machine/certs/ca-key.pem",
        "SwarmMaster": false,
        "SwarmHost": "tcp://0.0.0.0:3376",
        "SwarmDiscovery": ""
    },
    "StorePath": "/Users/tbarlow/.docker/machine/machines/virtualbox-test-default",
    "HostOptions": {
        "Driver": "",
        "Memory": 0,
        "Disk": 0,
        "EngineOptions": {
            "Dns": null,
            "GraphDir": "",
            "Ipv6": false,
            "Labels": null,
            "LogLevel": "",
            "StorageDriver": "",
            "SelinuxEnabled": false,
            "TlsCaCert": "",
            "TlsCert": "",
            "TlsKey": "",
            "TlsVerify": false,
            "RegistryMirror": null
        },
        "SwarmOptions": {
            "IsSwarm": false,
            "Address": "",
            "Discovery": "",
            "Master": false,
            "Host": "tcp://0.0.0.0:3376",
            "Strategy": "",
            "Heartbeat": 0,
            "Overcommit": 0,
            "TlsCaCert": "",
            "TlsCert": "",
            "TlsKey": "",
            "TlsVerify": false
        },
        "AuthOptions": {
            "StorePath": "/Users/tbarlow/.docker/machine/machines/virtualbox-test-default",
            "CaCertPath": "/Users/tbarlow/.docker/machine/certs/ca.pem",
            "CaCertRemotePath": "",
            "ServerCertPath": "/Users/tbarlow/.docker/machine/certs/server.pem",
            "ServerKeyPath": "/Users/tbarlow/.docker/machine/certs/server-key.pem",
            "ClientKeyPath": "/Users/tbarlow/.docker/machine/certs/key.pem",
            "ServerCertRemotePath": "",
            "ServerKeyRemotePath": "",
            "PrivateKeyPath": "/Users/tbarlow/.docker/machine/certs/ca-key.pem",
            "ClientCertPath": "/Users/tbarlow/.docker/machine/certs/cert.pem"
        }
    },
    "SwarmHost": "",
    "SwarmMaster": false,
    "SwarmDiscovery": "",
    "CaCertPath": "",
    "PrivateKeyPath": "",
    "ServerCertPath": "",
    "ServerKeyPath": "",
    "ClientCertPath": "",
    "ClientKeyPath": ""
}

VirtualBox configuration looks good too:
screen shot 2015-03-25 at 22 35 34

[ 🔵 PASS] 2. Can create VirtualBox machine with custom boot2docker image, with disk size 20,000MB and 1024MB memory

$ docker-machine create -d virtualbox --virtualbox-disk-size "20000" --virtualbox-memory "1024" --virtualbox-boot2docker-url https://github.com/boot2docker/boot2docker/releases/download/v1.4.1/boot2docker.iso virtualbox-test
INFO[0000] Downloading boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v1.4.1/boot2docker.iso...
INFO[0029] Creating SSH key...
INFO[0030] Creating VirtualBox VM...
INFO[0036] Starting VirtualBox VM...
INFO[0036] Waiting for VM to start...
INFO[0070] "virtualbox-test" has been created and is now the active machine.
INFO[0070] To point your Docker client at it, run this in your shell: eval "$(docker-machine env virtualbox-test)"

$ docker-machine inspect virtualbox-test
{
    "DriverName": "virtualbox",
    "Driver": {
        "MachineName": "virtualbox-test",
        "SSHUser": "docker",
        "SSHPort": 49414,
        "Memory": 1024,
        "DiskSize": 20000,
        "Boot2DockerURL": "https://github.com/boot2docker/boot2docker/releases/download/v1.4.1/boot2docker.iso",
        "CaCertPath": "/Users/tbarlow/.docker/machine/certs/ca.pem",
        "PrivateKeyPath": "/Users/tbarlow/.docker/machine/certs/ca-key.pem",
        "SwarmMaster": false,
        "SwarmHost": "tcp://0.0.0.0:3376",
        "SwarmDiscovery": ""
    },
    "StorePath": "/Users/tbarlow/.docker/machine/machines/virtualbox-test",
    "HostOptions": {
        "Driver": "",
        "Memory": 0,
        "Disk": 0,
        "EngineOptions": {
            "Dns": null,
            "GraphDir": "",
            "Ipv6": false,
            "Labels": null,
            "LogLevel": "",
            "StorageDriver": "",
            "SelinuxEnabled": false,
            "TlsCaCert": "",
            "TlsCert": "",
            "TlsKey": "",
            "TlsVerify": false,
            "RegistryMirror": null
        },
        "SwarmOptions": {
            "IsSwarm": false,
            "Address": "",
            "Discovery": "",
            "Master": false,
            "Host": "tcp://0.0.0.0:3376",
            "Strategy": "",
            "Heartbeat": 0,
            "Overcommit": 0,
            "TlsCaCert": "",
            "TlsCert": "",
            "TlsKey": "",
            "TlsVerify": false
        },
        "AuthOptions": {
            "StorePath": "/Users/tbarlow/.docker/machine/machines/virtualbox-test",
            "CaCertPath": "/Users/tbarlow/.docker/machine/certs/ca.pem",
            "CaCertRemotePath": "",
            "ServerCertPath": "/Users/tbarlow/.docker/machine/certs/server.pem",
            "ServerKeyPath": "/Users/tbarlow/.docker/machine/certs/server-key.pem",
            "ClientKeyPath": "/Users/tbarlow/.docker/machine/certs/key.pem",
            "ServerCertRemotePath": "",
            "ServerKeyRemotePath": "",
            "PrivateKeyPath": "/Users/tbarlow/.docker/machine/certs/ca-key.pem",
            "ClientCertPath": "/Users/tbarlow/.docker/machine/certs/cert.pem"
        }
    },
    "SwarmHost": "",
    "SwarmMaster": false,
    "SwarmDiscovery": "",
    "CaCertPath": "",
    "PrivateKeyPath": "",
    "ServerCertPath": "",
    "ServerKeyPath": "",
    "ClientCertPath": "",
    "ClientKeyPath": ""
}

screen shot 2015-03-25 at 22 44 41

And just to double check that we're running the 1.4.1 custom boot2docker image:

$ docker-machine ssh virtualbox-test
                        ##        .
                  ## ## ##       ==
               ## ## ## ##      ===
           /""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
           \______ o          __/
             \    \        __/
              \____\______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.4.1, build master : 86f7ec8 - Tue Dec 16 23:11:29 UTC 2014
Docker version 1.4.1, build 5bc2ff8

@soleo
Copy link
Contributor

soleo commented Mar 26, 2015

#dibs

@soleo
Copy link
Contributor

soleo commented Mar 27, 2015

I did check for MemorySize and DiskSize. Looks like need to check boot2docker url as well. Everything looks good in my commit? If this approach is good, I think I could use the same method to close all the other issues related with flag checking.

@ehazlett
Copy link
Contributor

@soleo thanks! commented in that PR

soleo added a commit to soleo/machine that referenced this issue Mar 27, 2015
Signed-off-by: Xinjiang Shao <shaoxinjiang@gmail.com>
soleo added a commit to soleo/machine that referenced this issue Mar 27, 2015
… vmbox is created.

Fix docker#843

Signed-off-by: Xinjiang Shao <shaoxinjiang@gmail.com>
@nathanleclaire
Copy link
Contributor

This looks good I think

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants