Integration tests running in azure pipelines (#516)

This commit is contained in:
Craig Peterson 2019-07-02 12:32:54 -04:00 committed by GitHub
parent ffc0a10c64
commit 08deda6746
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 78 additions and 0 deletions

View file

@ -0,0 +1,69 @@
variables:
GOBIN: '$(GOPATH)/bin' # Go binaries path
GOROOT: '/usr/local/go1.12' # Go installation path
GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path
modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)' # Path to the module's code
wd: '$(modulePath)/integrationTest'
trigger:
batch: "true"
branches:
include:
- pipeline
# Each provider gets its' own job. These will run in parallel.
# each job gets setup with only the env vars it needs for that run.
# these are defined in azure pipelines web ui as secret variables.
jobs:
- job: Route53
steps:
- template: go-env.yaml
- script: go test -v -verbose -provider ROUTE53
workingDirectory: $(wd)
env:
R53_DOMAIN: $(R53_DOMAIN)
R53_KEY_ID: $(R53_KEY_ID)
R53_KEY: $(R53_KEY)
- job: GCloud
steps:
- template: go-env.yaml
- script: go test -v -verbose -provider GCLOUD
workingDirectory: $(wd)
env:
GCLOUD_DOMAIN: $(GCLOUD_DOMAIN)
GCLOUD_TYPE: $(GCLOUD_TYPE)
GCLOUD_EMAIL: $(GCLOUD_EMAIL)
GCLOUD_PROJECT: $(GCLOUD_PROJECT)
GCLOUD_PRIVATEKEY: $(GCLOUD_PRIVATEKEY)
- job: NameDotCom
steps:
- template: go-env.yaml
- script: go test -v -verbose -provider NAMEDOTCOM
workingDirectory: $(wd)
env:
NAMEDOTCOM_DOMAIN: $(NAMEDOTCOM_DOMAIN)
NAMEDOTCOM_KEY: $(NAMEDOTCOM_KEY)
NAMEDOTCOM_USER: $(NAMEDOTCOM_USER)
- job: Cloudflare
steps:
- template: go-env.yaml
- script: go test -v -verbose -provider CLOUDFLAREAPI
workingDirectory: $(wd)
env:
CF_USER: $(CF_USER)
CF_DOMAIN: $(CF_DOMAIN)
CF_KEY: $(CF_KEY)
- job: DigitalOcean
steps:
- template: go-env.yaml
- script: go test -v -verbose -provider DIGITALOCEAN
workingDirectory: $(wd)
env:
DO_DOMAIN: $(DO_DOMAIN)
DO_TOKEN: $(DO_TOKEN)

View file

@ -4,6 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"strconv"
"strings"
@ -371,6 +372,8 @@ func (c *CloudflareApi) get(endpoint string, target interface{}) error {
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
dat, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(dat))
return errors.Errorf("bad status code from cloudflare: %d not 200", resp.StatusCode)
}
decoder := json.NewDecoder(resp.Body)

View file

@ -42,6 +42,12 @@ type gcloud struct {
// New creates a new gcloud provider
func New(cfg map[string]string, metadata json.RawMessage) (providers.DNSServiceProvider, error) {
// the key as downloaded is json encoded with literal "\n" instead of newlines.
// in some cases (round-tripping through env vars) this tends to get messed up.
// fix it if we find that.
if key, ok := cfg["private_key"]; ok {
cfg["private_key"] = strings.Replace(key, "\\n", "\n", -1)
}
raw, err := json.Marshal(cfg)
if err != nil {
return nil, err