Skip to content

Commit

Permalink
Added CI test
Browse files Browse the repository at this point in the history
Signed-off-by: Olli Janatuinen <[email protected]>
  • Loading branch information
olljanat committed Oct 14, 2018
1 parent b126976 commit 82b869e
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: 2
jobs:
build:
working_directory: /home/circleci/.go_workspace/src/github.com/citrix/terraform-provider-netscaler/tests
machine: true
environment:
NETSCALER_VERSION: 12.0-56.20
TERRAFORM_VERSION: 0.11.8
steps:
- checkout:
path: /home/circleci/.go_workspace/src/github.com/citrix/terraform-provider-netscaler/

- run:
name: Build
command: |
go build -o terraform-provider-netscaler ../main.go
- run:
name: Install Terraform
command: |
wget https://releases.hashicorp.com/terraform/$TERRAFORM_VERSION/terraform_${TERRAFORM_VERSION}_linux_amd64.zip
unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip
chmod a+x terraform
- run:
name: Prepare Netscaler
command: |
echo $DOCKERPWD|docker login -u $DOCKERUSER --password-stdin
docker run --rm --name netscaler -p 80:80 --env EULA=yes --detach --cap-add=NET_ADMIN store/citrix/netscalercpx:$NETSCALER_VERSION
sleep 30s
docker exec netscaler /var/netscaler/bins/cli_script.sh "save ns conf"
- run:
name: Run tests
command: |
./terraform init
./terraform apply -no-color -auto-approve
docker exec netscaler /var/netscaler/bins/cli_script.sh "save ns conf"
- run:
name: Verify plan
command: |
./terraform plan
- run:
name: Cleanup
command: docker stop netscaler

5 changes: 5 additions & 0 deletions tests/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
provider "netscaler" {
endpoint = "http://localhost/"
username = "nsroot"
password = "nsroot"
}
7 changes: 7 additions & 0 deletions tests/resources.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resource "netscaler_lbvserver" "test_lb" {
name = "testLB"
ipv46 = "1.2.3.4"
port = "80"
servicetype = "HTTP"
}

0 comments on commit 82b869e

Please sign in to comment.