diff options
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | scripts/build.sh (renamed from build.sh) | 7 | ||||
| -rw-r--r-- | scripts/commons.sh (renamed from commons.sh) | 0 | ||||
| -rw-r--r-- | scripts/local-install.sh (renamed from local-install.sh) | 2 | ||||
| -rw-r--r-- | src/go.mod | 2 | ||||
| -rw-r--r-- | src/provider_test.go | 8 | ||||
| -rw-r--r-- | src/resource_project_test.go | 2 |
7 files changed, 13 insertions, 12 deletions
@@ -13,8 +13,8 @@ This repository is a work in progress and is not yet suitable for production wor * Installing the provider ```bash -./build.sh # build & test provider code -./local-install.sh # install provider locally +./scripts/build.sh # build & test provider code +./scripts/local-install.sh # install provider locally ``` * Using the provider diff --git a/build.sh b/scripts/build.sh index 57bdef69..241bded5 100644 --- a/build.sh +++ b/scripts/build.sh @@ -2,14 +2,15 @@ set -euo pipefail -. ./commons.sh +. $(dirname $0)/commons.sh function clean() { + info "Cleaning $BUILD_DIR" rm -rf "$BUILD_DIR" mkdir -p "$BUILD_DIR" } -function test() { +function unittest() { info "Executing unit tests" ( cd "$SOURCE_DIR" @@ -34,7 +35,7 @@ function compile() { function clean_and_build() { clean - # test - enable in https://github.com/nmiodice/terraform-azure-devops-hack/issues/31 + unittest compile info "Build finished successfully" } diff --git a/commons.sh b/scripts/commons.sh index 04d96019..04d96019 100644 --- a/commons.sh +++ b/scripts/commons.sh diff --git a/local-install.sh b/scripts/local-install.sh index 4c93ebdd..d235a9b7 100644 --- a/local-install.sh +++ b/scripts/local-install.sh @@ -2,7 +2,7 @@ set -euo pipefail -. ./commons.sh +. $(dirname $0)/commons.sh PLUGINS_DIR="$HOME/.terraform.d/plugins/" @@ -1,4 +1,4 @@ -module github.com/nmiodice/terraform-provider-azure-devops +module github.com/microsoft/terraform-provider-azuredevops go 1.12 diff --git a/src/provider_test.go b/src/provider_test.go index e5e19ac0..7eb3d314 100644 --- a/src/provider_test.go +++ b/src/provider_test.go @@ -9,11 +9,11 @@ import ( func TestProviderResourcesMap(t *testing.T) { resources := Provider().ResourcesMap - // Note: these tests are trivial and need to be changed quite a bit when a real implementation - // exists... These are mostly here so that you write better tests during the hack... :) require.Equal(t, 2, len(resources), "Two resources were expected to be defined by the provider.") - require.Contains(t, resources, "azuredevops_foo", "Expected resource schema was not found in the provider.") + + require.Contains(t, resources, "azuredevops_pipeline", "Expected resource schema was not found in the provider.") + require.NotNil(t, resources["azuredevops_pipeline"], "Resource schema cannot be nil.") + require.Contains(t, resources, "azuredevops_project", "Expected resource schema was not found in the provider.") - require.NotNil(t, resources["azuredevops_foo"], "Resource schema cannot be nil.") require.NotNil(t, resources["azuredevops_project"], "Resource schema cannot be nil.") } diff --git a/src/resource_project_test.go b/src/resource_project_test.go index 0666a9c1..cf85be85 100644 --- a/src/resource_project_test.go +++ b/src/resource_project_test.go @@ -32,6 +32,6 @@ func TestProjectCreate_MapsTfState(t *testing.T) { ctx: context.Background(), } - _, err := projectCreate(clients, testValues) + err := projectCreate(clients, testValues) require.Equal(t, "Whoops", err.Error()) } |
