Skip to content

Commit 62e01dd

Browse files
committed
Merge pull request Azure#1669 from stankovski/clu
Added steps for docker setup and run
2 parents 29a2ac2 + 04fde66 commit 62e01dd

File tree

2 files changed

+59
-14
lines changed

2 files changed

+59
-14
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ RUN apt-get update && \
1414
libicu-dev \
1515
uuid-dev \
1616
curl \
17-
unzip
17+
unzip \
18+
jq
1819

1920
RUN curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_USER_HOME=$DNX_USER_HOME DNX_BRANCH=v$DNX_VERSION sh
2021

clu-getstart.md

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Work on CLU cmdlets
22

3-
### Prerequsites
3+
## Prerequsites
44

55
* Visual Studio 2015 RTM with ASP.NET. For details, check out the [installation doc](http://docs.asp.net/en/latest/getting-started/installing-on-windows.html).
66

77
Note, after done, run `dnvm list` command to check the 'coreclr' runtime is installed with right version of `1.0.0-rc1-final`. If not, run `dnvm install 1.0.0-rc1-final -r coreclr -a x64 -p`. Remember always use `-p` flag, so the selection can persist.
88

99
* Get the latest dotnet from "https://azureclu.blob.core.windows.net/tools/dotnet-win-x64.latest.zip", unzip, then add its bin folder to the PATH
1010

11-
### Project Artifacts
11+
## Project Artifacts
1212

1313
CLUPackages require some additional files to direct generation of indexing, and to provide shortcuts when files are installed. These files can be copied from the Profile project and updated for each package.
1414

@@ -47,7 +47,7 @@ CLUPackages require some additional files to direct generation of indexing, and
4747
}
4848
```
4949

50-
### Package Creation and Testing
50+
## Package Creation and Testing
5151
Two options
5252
1. Run `<repo-root>\tools\CLU\BuildAndInstallClu.bat` which build and generate all cmdlet packages and deploy to under `<repo root>\drop\clurun` folder, with 3 flavors `win7-x64`, `osx.10.10-x64` and `ubuntu.14.04-x64`. When you have a clean environment or just pull from upstream, you should clean temporary bits such as `git clean -xdf`, and run this command.
5353
2. Run `<repo-root>\tools\CLU\BuildCmdlet <package name like Microsoft.Azure.Commands.Profile>` <name like: Microsoft.Azure.Commands.Profile>", this will build and refresh an individual cmdlet package.
@@ -62,7 +62,7 @@ To test on osx/linux boxes, do #1, open `<repo-root>\drop\clurun`, copy the flav
6262

6363
(All of those are subject to change, contact yugangw or adxsdkdev for any questions)
6464

65-
### Quick introductions on cmdlets
65+
## Quick introductions on cmdlets
6666
* Run commands using the ‘az’ prefix, cmdlet nouns, and cmdlet verbs, for example, `az env get` maps to the cmdlet `Get-AzureRmEnvironment`
6767
* Cmdlet parameters use the double dash (--) so for example, getting a subscription with a particular name would be: `az subscription get –-SubscriptionName “name of subscription"`
6868
* To log in, 3 options
@@ -82,19 +82,19 @@ To test on osx/linux boxes, do #1, open `<repo-root>\drop\clurun`, copy the flav
8282

8383
```set AzureProfile=1010 ```
8484

85-
### Testing Cmdlets
85+
## Testing Cmdlets
8686

87-
#### Environment setup (Windows)
87+
### Environment setup (Windows)
8888
- Install latest version of [Git for Windows](https://git-scm.com/download/win) that has `bash 4.x` available.
8989
- Install `jq` using chocolatey `choco install jq` (chocolatey can be installed from [here](https://chocolatey.org/)).
9090

91-
#### Test Infrastructure
91+
### Test Infrastructure
9292
Testing will consist of scenario tests and unit tests. Scenario tests should be written in a form of an example and be available in `.ps1` and `.sh` formats.
9393

94-
#### Scenario Tests
94+
### Scenario Tests
9595
- Scenario tests should be saved under `./examples` directory with one directory per package. Each scenario tests should (eventually) consist of both `.ps1` and `.sh` files and should cover "P0" scenarios.
9696

97-
##### Environment Variables for Authentication
97+
#### Environment Variables for Authentication
9898
Please set the environment variables for either Username/Password (no 2FA) or ServicePrincipal authentication:
9999

100100
**Username/Password (without 2-factor auth):**
@@ -114,7 +114,7 @@ Please set the environment variables for either Username/Password (no 2FA) or Se
114114
| tenant | The tenant guid to authenticate against |
115115
| spnSubscription | (optional) Selects a particular subscription by id. If not provided, the first listed subscription will be selected |
116116

117-
##### XUnit Automation For Bash Scenario Tests
117+
#### XUnit Automation For Bash Scenario Tests
118118
- The ```Commands.Common.ScenarioTest``` project contains classes that enable executing bash scenario tests in Visual Studio, or cross-platform using dnx.
119119

120120
- To implement an xunit bash scenario test you must
@@ -161,24 +161,68 @@ runner.EnvironmentVariables.Add("myVariableName", runner.GenerateName("myres"));
161161
| ExamplesDirectory | The path to the 'examples' directory ($pshome/examples) |
162162
| TestDirectory | The path to the directory where logs will be written |
163163

164-
##### Running Bash Tests using Bash shell
164+
#### Running Tests in Docker
165+
##### Docker Setup
166+
**Option 1 - VirtualBox:**
167+
Install ToolBox from this link - https://docs.docker.com/engine/installation/windows/
168+
169+
**Option 2 - Hyper-V:**
170+
171+
1. Install ToolBox from this link - https://docs.docker.com/engine/installation/windows/ (uninstall VirtualBox afterwards)
172+
2. http://sa.muel.be/2015/run-docker-on-hyper-v-with-docker-machine/
173+
* Increase VHD to 100GB (--hyperv-disk-size 100000)
174+
* List of other switches for create command - https://docs.docker.com/machine/drivers/hyper-v/
175+
176+
##### Workflow
177+
1. Build packages (see [instructions](#package-creation-and-testing))
178+
2. From command line with admin priveleges navigate to azure-powershell root folder and run ```docker build .```
179+
3. Copy image id from the output. For example in the output below the image id is *26f067684da3*:
180+
181+
```
182+
Successfully built 26f067684da3
183+
```
184+
4. Run ```docker run -it [IMAGEID]``` to SSH into the Docker image
185+
5. In the SSH window run:
186+
187+
```bash
188+
export azureUser=<[email protected]>
189+
export password=<your_password>
190+
export userSubscription=<subscription>
191+
export spn=<spn-guid>
192+
export secret=<spn-secret>
193+
export tenant=<spn-tenant>
194+
export spnSubscription=<subscription>
195+
export azureUser=<[email protected]>
196+
export password=<your_password>
197+
dnx test
198+
```
199+
200+
201+
#### Running Bash Tests using Bash shell
165202
- Bash tests should be runnable from bash shell in windows/linux/mac environments.
166203
- To manually run the tests; please set [environment variables](#Environment_Variables_for_Authentication) for authentication as well as update PATH and run `./examples/lib/testrunner.sh`
167204

168205
```bash
169206
export azureUser=<[email protected]>
170207
export password=<your_password>
208+
export userSubscription=<subscription>
209+
export spn=<spn-guid>
210+
export secret=<spn-secret>
211+
export tenant=<spn-tenant>
212+
export spnSubscription=<subscription>
213+
export azureUser=<[email protected]>
214+
export password=<your_password>
171215
export PATH=/<path-to-drop>/clurun/win7-x64/:$PATH
172216
```
173217
- All the parameters to the cmdlets should be passed in as environment variables
174218
- The current test runners will provide a unique resource group name via `$groupName` but may not remove it at the end if the test fails.
175219
- The location for ARM will be provided via variable `$location`.
176220
- "jq" package and BASH assert (e.g. `[ "foo" == "bar" ]`) should be used to validate the responses.
177221

178-
##### PowerShell Tests
222+
#### PowerShell Tests
179223
TODO: Add section on PowerShell testing
180224

181-
#### Unit Tests
225+
### Unit Tests
182226
TODO: Add section on unit testing
183227

184228

0 commit comments

Comments
 (0)