User Tools

Site Tools


juju-testing

Running Juju-Core tests on Windows

Installing a base Windows system

First we need to install a Windows machine, obviously. A very light weight windows version (and free) can be found at this link. You may need to register first, but that's free and mostly painless.

You can install this version of Windows on top of KVM using any ubuntu version >= Ubuntu 14.04. Installation steps are simple, just follow the wizard.

Post install steps

Windows Hyper-V Server 2012 is basically a stripped down version of windows with no GUI (well almost, as the Windows GUI is baked into the kernel). When you first login, you should see something like this:

Don't panic, we should still have access to everything we need.

Enable RDP

To make our lives easier, lets get remote desktop working. This will allow clipboard sharing:

  1. select option 7
  2. type in “E” and then hit enter
  3. select 2 and hit enter

This will enable remote desktop. Now let's disable the firewall (you don't really need it for testing). In the black cmd terminal type:

netsh advfirewall set allprofiles state off

You should now be able to connect to your Windows machine via your favourite RDP client. On Ubuntu systems, my personal preference is Remmina, but any client should work.

Installing Chocolatey

Chocolatey is awesome. Why it's not default in windows is beyond me. In essence its a Windows version of a package manager like apt-get or yum. So let's have us a little bit of chocolate. First lets get a PowerShell prompt. Working on Windows after so many years of using Linux, I have found that PowerShell is a more friendly tool than cmd, as it is better suited to my muscle memory. It has things like ls, mkdir, mv, rm aliased to powershell commandlets. Granted the options differ, but at least in their simplest forms, you get to use familiar commands. So let's open up a PowerShell terminal:

start powershell

You should now have something like this:

In that terminal, copy and paste the following command:

iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))

Congrats, you now have chocolatey installed. Here is a list of packages available in the chocolatey repository

Installing scm and golang

Its time to install the various scm binaries needed by go, and also version 1.2.1 of Go to mirror the version used in Ubuntu 14.04. Follow the instructions on the following link.

Installing SCM systems and golang

Getting a SSL enabled version of mongod.exe

Apparently, the windows version of mongod comes with SSL disabled on windows. You basically have two options to get SSL support on windows:

  1. Buy the payed version
  2. compile your own

You can get a precompiled version of mongod.exe here. (md5: 27a623932453e1cf80c6889a81335ee8)

To download it via PowerShell type in the following command in the PowerShell prompt:

Start-BitsTransfer http://wiki.cloudbase.it/_media/mongo-static.zip

If you have not already done so, install 7zip:

choco install -y 7zip

You will also need the Visual Studio redistributable package for mongo to work:

choco install -y vcredist2013
choco install -y vcredist2008

Now let's extract mongo:

& 'C:\Program Files\7-Zip\7z.exe' x mongo-static.zip

You should have a a mongod.exe file. Lets check if it actually works:

PS C:\Users\Administrator> .\mongod.exe --version
db version v2.6.3
2015-04-03T11:57:55.699-0700 git version: 255f67a66f9603c59380b2a389e386910bbb52cb
2015-04-03T11:57:55.699-0700 OpenSSL version: OpenSSL 0.9.8r 8 Feb 2011

Adding mongod to your $PATH

Lets create a folder for it first:

mkdir C:\bin

Copy mongod.exe to it:-35

cp mongod.exe C:\bin\

Add C:\bin to path:

$env:PATH += ";C:\bin"
setx PATH $env:PATH

Running the juju tests

At this point, if you followed the steps here you should already have a golang setup with a local copy of the juju repository.

Navigate to that folder:

cd $env:GOPATH\src\github.com\juju\juju
go test ./...

Accessing the machine from Linux

Some of you might want to edit the go source from Linux using your favorite editors. To do that we can set up a share.

sudo mount -t cifs -o username=Administrator,password=<password>,uid=$UID,gid=$GID //<hostname>/C$ <mountpoint>

Now all of your C drive will be available at <mountpoint>.

As a bonus, you can use https://github.com/masterzen/winrm to winrm directly into the machine and run the test suite from the comfort of your shell. Follow the instructions provided in the github repository, but set the maximum memory allowed at however much the machine has instead of 1024. The test suite tends to eat quite a lot of memory. This does not necessarily depend on this particular winrm package, but it just simply works and will probably get integrated in juju as well soon.

Bonus:

Thanks for tagging along, I really appreciate it. As a sign of my appreciation, the following commands can be run inside a PowerShell session to install firefox:

(new-object System.Net.WebClient).DownloadFile("https://download.mozilla.org/?product=firefox-35.0.1-SSL&os=win&lang=en-US", "$HOME\firefox_installer.exe")
cmd.exe /C call $HOME\firefox_installer.exe /SILENT

Or the package management way:

choco install -y firefox

And to launch it:

& 'C:\Program Files (x86)\Mozilla Firefox\firefox.exe'

You may now enjoy the simple pleasures in life once more, like giving a quick Google or downloading an MSI installer right from the comfort of your own blue-on-black free version of Windows Server

juju-testing.txt · Last modified: 2015/07/09 15:54 by bteleaga