Commit 7de3b708 authored by Erin Krengel's avatar Erin Krengel
Browse files

Revert "Use kx"

This reverts commit ddce41f1.
parent fa198404
......@@ -11,12 +11,12 @@ import (
"log"
"net/http"
"os"
"reflect"
"testing"
"time"
"cloud.google.com/go/pubsub"
"cloud.google.com/go/storage"
"github.com/stretchr/testify/assert"
)
type config struct {
......@@ -34,7 +34,7 @@ func TestMain(m *testing.M) {
// environment variable is not set.
testConfig = config{
project: getConfigurationValue("PROJECT"),
serviceName: getConfigurationValue("SERVICE_NAME"),
serviceName: getConfigurationValue("SERVICE_NAME"),
bucketName: getConfigurationValue("BUCKET"),
subscriptionName: getConfigurationValue("SUBSCRIPTION"),
}
......@@ -42,105 +42,63 @@ func TestMain(m *testing.M) {
}
func TestSimpleHappyPath(t *testing.T) {
ctx, cancelCtx := context.WithTimeout(context.Background(), 2*time.Minute)
pubsubClient, err := pubsub.NewClient(ctx, testConfig.project)
if err != nil {
log.Fatalf("cannot create pubsub client: %v", err)
}
t.Logf("CONFIGURATION: %+v\n", testConfig)
// ARRANGE
// Setup clients to talk to GCP resources.
ctx := context.Background()
client, err := storage.NewClient(ctx)
bkt := client.Bucket(testConfig.bucketName)
pubsubCtx, cancelCtx := context.WithTimeout(ctx, 2*time.Minute)
subscription := setupSubscription(t, pubsubCtx)
// Create a test message.
testMsg := map[string]string{"message": "Ruby is awesome!"}
var objectName string
t.Run("posting a message returns 202", func(t *testing.T) {
url := fmt.Sprintf("http://%s/message", testConfig.serviceName)
bodyBytes, err := json.Marshal(testMsg)
if err != nil {
t.Fatalf("unable to marshal test msg: %v", err)
}
resp, err := http.Post(url, "application/json", bytes.NewBuffer(bodyBytes))
if err != nil {
t.Fatalf("unable to hit endpoint: %v", err)
}
if resp.StatusCode != http.StatusAccepted {
t.Fatalf("expected a 202 response code, received : %d", resp.StatusCode)
}
defer resp.Body.Close()
rawBody, err := ioutil.ReadAll(resp.Body)
if err != nil {
t.Fatalf("unable read body: %v", err)
}
body := make(map[string]string)
err = json.Unmarshal(rawBody, &body)
if err != nil {
t.Fatalf("unable unmarshal response body: %v", err)
}
objectName = body["name"]
})
// ACT
// Post test message.
resp := postTestMessage(t, testMsg)
// ASSERT
// Validate the response status code.
assert.Equal(t, http.StatusAccepted, resp.StatusCode)
// Read and validate the response body.
defer resp.Body.Close()
rawBody, err := ioutil.ReadAll(resp.Body)
assert.NoError(t, err)
objectName := getObjectNameFromBytes(t, rawBody)
t.Run("message is sent to PubSub topic", func(t *testing.T) {
sub := pubsubClient.Subscription(testConfig.subscriptionName)
receivedMsg := make(map[string]string)
err := sub.Receive(ctx, func(ctx context.Context, m *pubsub.Message) {
err = json.Unmarshal(m.Data, &receivedMsg)
if err != nil {
t.Fatalf("unable to unmarshal received msg: %v", err)
}
// Receive message from the subscription.
var receivedBytes []byte
err := subscription.Receive(pubsubCtx, func(ctx context.Context, m *pubsub.Message) {
receivedBytes = m.Data
m.Ack()
cancelCtx()
})
if err != nil {
t.Fatalf("unable to receive from subscription: %v", err)
}
assert.NoError(t, err)
if objectName != receivedMsg["name"] {
t.Fatalf("object name mismatch. expected: %s, received: %s", objectName, receivedMsg["name"])
}
// Validate received message and the the object name matches
// the object name previously return from the service.
receivedObjectName := getObjectNameFromBytes(t, receivedBytes)
assert.Equal(t, objectName, receivedObjectName)
})
t.Run("message is stored in bucket", func(t *testing.T) {
ctx = context.Background()
client, err := storage.NewClient(ctx)
bkt := client.Bucket(testConfig.bucketName)
reader, err := bkt.Object(objectName).NewReader(ctx)
if err != nil {
t.Fatalf("readFile: unable to open file from bucket %q, file %q: %v", testConfig.bucketName, objectName, err)
}
defer reader.Close()
bytes, err := ioutil.ReadAll(reader)
if err != nil {
t.Fatalf("readFile: unable to read data from bucket %q, file %q: %v", testConfig.bucketName, objectName, err)
}
storedMsg := make(map[string]string)
json.Unmarshal(bytes, &storedMsg)
if !reflect.DeepEqual(testMsg, storedMsg) {
t.Fatalf("expected: %s, stored: %s", testMsg, storedMsg)
}
// Clean up after our test. Delete the object so we can delete the bucket.
err = bkt.Object(objectName).Delete(ctx)
if err != nil {
t.Logf("deleteFile: unable to delete data from bucket %q, file %q: %v", testConfig.bucketName, objectName, err)
}
// Check the stored message is the one we sent.
storedMsg := readStoredObject(ctx, t, bkt, objectName)
assert.EqualValues(t, testMsg, storedMsg)
})
// Clean up after our test. Delete the object so we can delete the bucket.
err = bkt.Object(objectName).Delete(ctx)
assert.NoError(t, err)
}
func TestSimpleSadPath(t *testing.T) {
t.Run("posting a incorrectly formatted message returns 400", func(t *testing.T) {
bodyBytes, _ := json.Marshal("this wont unmarshal")
url := fmt.Sprintf("http://%s/message", testConfig.serviceName)
resp, err := http.Post(url, "application/json", bytes.NewBuffer(bodyBytes))
if err != nil {
t.Fatalf("unable to hit endpoint: %v", err)
}
if resp.StatusCode != http.StatusBadRequest {
t.Fatalf("expected a 400 response code, received : %d", resp.StatusCode)
}
resp := postTestMessage(t, "this wont unmarshal")
assert.Equal(t, http.StatusBadRequest, resp.StatusCode)
})
}
......@@ -149,6 +107,47 @@ func getConfigurationValue(envVar string) string {
if value == "" {
log.Fatalf("%s not set", envVar)
}
log.Printf("%s: %s", envVar, value)
return value
}
func getObjectNameFromBytes(t *testing.T, bytes []byte) string {
body := make(map[string]string)
err := json.Unmarshal(bytes, &body)
assert.NoError(t, err)
objectName := body["name"]
assert.NotZero(t, objectName)
return objectName
}
func setupSubscription(t *testing.T, ctx context.Context) *pubsub.Subscription {
pubsubClient, err := pubsub.NewClient(ctx, testConfig.project)
assert.NoError(t, err)
sub := pubsubClient.Subscription(testConfig.subscriptionName)
return sub
}
func postTestMessage(t *testing.T, msg interface{}) *http.Response {
url := fmt.Sprintf("http://%s/message", testConfig.serviceName)
bodyBytes, err := json.Marshal(msg)
assert.NoError(t, err)
resp, err := http.Post(url, "application/json", bytes.NewBuffer(bodyBytes))
assert.NoError(t, err)
return resp
}
func readStoredObject(ctx context.Context, t *testing.T, bkt *storage.BucketHandle, objectName string) map[string]string {
reader, err := bkt.Object(objectName).NewReader(ctx)
assert.NoError(t, err)
defer reader.Close()
bytes, err := ioutil.ReadAll(reader)
assert.NoError(t, err)
storedMsg := make(map[string]string)
err = json.Unmarshal(bytes, &storedMsg)
assert.NoError(t, err)
t.Logf("Stored message: %+v", storedMsg)
return storedMsg
}
......@@ -5,6 +5,8 @@ go 1.13
require (
cloud.google.com/go v0.47.0 // indirect
cloud.google.com/go/pubsub v1.0.1
cloud.google.com/go/storage v1.0.0
github.com/jstemmer/go-junit-report v0.9.1 // indirect
github.com/stretchr/testify v1.4.0
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a // indirect
)
......@@ -20,6 +20,8 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
......@@ -52,10 +54,18 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1
github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
......@@ -162,8 +172,12 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
......
......@@ -9,5 +9,6 @@ require (
github.com/jstemmer/go-junit-report v0.9.1 // indirect
github.com/pkg/errors v0.8.1
github.com/satori/go.uuid v1.2.0
github.com/stretchr/testify v1.4.0 // indirect
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a // indirect
)
......@@ -20,6 +20,8 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
......@@ -59,9 +61,14 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
......@@ -169,9 +176,12 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
......
import * as k8s from "@pulumi/kubernetes";
import * as kx from "@pulumi/kubernetesx";
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
import * as svcKey from "./svcKey";
......@@ -17,7 +16,7 @@ interface AcceptanceConfig {
clusterProvider: k8s.Provider;
}
export function setupAcceptanceTests(config: AcceptanceConfig): k8s.batch.v1.Job {
export function SetupAcceptanceTests(config: AcceptanceConfig): k8s.batch.v1.Job {
const name = `${config.env}-demo-app-acc-test`;
// Create subscription on the app's topic.
......@@ -45,44 +44,55 @@ export function setupAcceptanceTests(config: AcceptanceConfig): k8s.batch.v1.Job
const serviceAccountKey = svcKey.getSvcKey(name, config.accSvcAccountId);
// Create a K8s secret from the service account key to mount to our K8s job.
const secret = new kx.Secret(name, {
const secret = new k8s.core.v1.Secret(name, {
metadata: {
name: `${config.env}-google-cloud-key-acc-test`,
},
stringData: { "key.json": serviceAccountKey },
}, { provider: config.clusterProvider });
// Define the pod for our acceptance tests.
const secretDestPath = "/var/secrets/google";
const podBuilder = new kx.PodBuilder({
containers: [{
name: name,
image: `rocore/demo-app-acceptance:${config.dockerTag}`,
imagePullPolicy: "Always",
env: {
"SUBSCRIPTION": subscription.name,
"BUCKET": config.bucket.name,
"PROJECT": config.project,
"SERVICE_NAME": config.appService.metadata.name,
"GOOGLE_APPLICATION_CREDENTIALS": `${secretDestPath}/key.json`,
},
volumeMounts: [secret.mount(secretDestPath)],
}],
restartPolicy: "Never",
});
// Create the job for our acceptance tests. The job will only run one time.
// By default, `pulumi up` will wait for the job to complete and only succeed
// if the container (aka our acceptance tests) exit successfully. The means we
// can simply run `pulumi up` to run our acceptance tests and determine if they
// succeeded or not.
const appLabels = { appClass: name };
return new kx.Job(name, {
return new k8s.batch.v1.Job(name, {
metadata: { labels: appLabels },
spec: podBuilder.asJobSpec({ backoffLimit: 0 }),
}, {
provider: config.clusterProvider,
customTimeouts: { create: "5m" },
dependsOn: [config.appDeployment]
});
spec: {
template: {
spec: {
containers: [{
name: name,
image: `rocore/demo-app-acceptance:${config.dockerTag}`,
imagePullPolicy: "Always",
env: [
{ name: "SUBSCRIPTION", value: subscription.name },
{ name: "BUCKET", value: config.bucket.name },
{ name: "PROJECT", value: config.project },
{ name: "SERVICE_NAME", value: pulumi.interpolate`${config.appService.metadata.name}` },
{ name: "GOOGLE_APPLICATION_CREDENTIALS", value: "/var/secrets/google/key.json" },
],
volumeMounts: [
{ name: "google-cloud-key", mountPath: "/var/secrets/google" }
]
}],
volumes: [
{
name: "google-cloud-key",
secret: { secretName: secret.metadata.name }
}
],
restartPolicy: "Never",
},
},
backoffLimit: 0,
},
},
{
provider: config.clusterProvider,
customTimeouts: { create: "5m" },
dependsOn: [config.appDeployment]
},
);
}
......@@ -135,7 +135,7 @@ const service = new k8s.core.v1.Service(name, {
// If it's a test environment, set up acceptance tests.
let job: k8s.batch.v1.Job | undefined;
if (ENV.startsWith("test")) {
job = acceptance.setupAcceptanceTests({
job = acceptance.SetupAcceptanceTests({
env: ENV,
project: project,
topic: topic,
......
......@@ -102,9 +102,9 @@
}
},
"@pulumi/gcp": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@pulumi/gcp/-/gcp-1.5.0.tgz",
"integrity": "sha512-krHtZpMwwTrlraKRyQraAl8hicG+OgHi+bp6KX2YywA1d9gEcpSnHnkXr2t20Xaqu2ZmP23PsTcG/dcesj1PRg==",
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@pulumi/gcp/-/gcp-1.2.0.tgz",
"integrity": "sha512-XjmHZJMaxHXOpvBILLmtPrN1l6UzUYnihkGQycIKoYkaqIaCBDvPBEx3Vdwrf/axSnG73WkP0hkcPO/ufZQ5/A==",
"requires": {
"@pulumi/pulumi": "^1.0.0",
"@types/express": "^4.16.0",
......@@ -112,11 +112,11 @@
}
},
"@pulumi/kubernetes": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@pulumi/kubernetes/-/kubernetes-1.2.2.tgz",
"integrity": "sha512-xz9/E0X0tlxl4nvFTA1OlbskaKWSSZy+hjIZdH+uOvsq5bDT0twM/0OG512PUk7RhHKBWpyJEVxngDKucpxuJg==",
"version": "0.25.1",
"resolved": "https://registry.npmjs.org/@pulumi/kubernetes/-/kubernetes-0.25.1.tgz",
"integrity": "sha512-QFMpvmjMNTd/MP1WJJ2gU7Y5hWX9rDHPKRYC3e0fE9E6btUJShhju9vWgChQPJbc8tE64QOJ8fqJU8gHmgoMjA==",
"requires": {
"@pulumi/pulumi": "^1.0.0",
"@pulumi/pulumi": "^0.17.18",
"@types/glob": "^5.0.35",
"@types/js-yaml": "^3.11.2",
"@types/node-fetch": "^2.1.4",
......@@ -126,43 +126,42 @@
"node-fetch": "^2.3.0",
"shell-quote": "^1.6.1",
"tmp": "^0.0.33"
}
},
"@pulumi/kubernetesx": {
"version": "0.1.1-dev.1573594718",
"resolved": "https://registry.npmjs.org/@pulumi/kubernetesx/-/kubernetesx-0.1.1-dev.1573594718.tgz",
"integrity": "sha512-lS5P/I2HSuXhnpTtGtDc/Hhl3h5Fj/LCrsRthpqlwnkCBHBLGuRpiNKsjbvqzHl7U4VmmwnhDKhZA7nFvrTPuw==",
"requires": {
"@pulumi/kubernetes": "^1.2.3",
"@pulumi/pulumi": "^1.5.1"
},
"dependencies": {
"@pulumi/kubernetes": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/@pulumi/kubernetes/-/kubernetes-1.2.3.tgz",
"integrity": "sha512-IuGvUeIJuQzVhyzq/sYXdw9p11qBvUW0xsrz4S/SkW1YRljEkgobZgFdiYRolu+HHHmjcs3ek3aocxPOAHGf5w==",
"@pulumi/pulumi": {
"version": "0.17.28",
"resolved": "https://registry.npmjs.org/@pulumi/pulumi/-/pulumi-0.17.28.tgz",
"integrity": "sha512-pVKahH9Ryl6wIpzdOKjsu2gEshDCA7elB34paJpPXw+3ARViSPri7y/2uTdmMRg36jsbrOdNGEohKJEqIZLioA==",
"requires": {
"@pulumi/pulumi": "^1.0.0",
"@types/glob": "^5.0.35",
"@types/js-yaml": "^3.11.2",
"@types/node-fetch": "^2.1.4",
"@types/tmp": "^0.0.33",
"glob": "^7.1.2",
"js-yaml": "^3.12.0",
"node-fetch": "^2.3.0",
"shell-quote": "^1.6.1",
"tmp": "^0.0.33"
"@pulumi/query": "^0.3.0",
"deasync": "^0.1.15",
"google-protobuf": "^3.5.0",
"grpc": "1.21.1",
"minimist": "^1.2.0",
"normalize-package-data": "^2.4.0",
"protobufjs": "^6.8.6",
"read-package-tree": "^5.3.1",
"require-from-string": "^2.0.1",
"semver": "^6.1.0",
"source-map-support": "^0.4.16",
"ts-node": "^7.0.0",
"typescript": "^3.0.0",
"upath": "^1.1.0"
}
},
"semver": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
}
}
},
"@pulumi/pulumi": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/@pulumi/pulumi/-/pulumi-1.5.1.tgz",
"integrity": "sha512-8/X83ouslBuha36ZfxJFtv3VolIMYO/KM0ZLP1JRFDcDrUfGFRdLhiYmnIOYvu9NhmsxplJ5meP6wFvTQ/GygQ==",
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@pulumi/pulumi/-/pulumi-1.2.0.tgz",
"integrity": "sha512-KowEnuaCzDaze5KNTAc5P1AjZNQdhagZZpz3nGV/Nz0u9cRVcTjlPmGBPMEUkc0AnRyi3kRKCdsqJGHguesVKQ==",
"requires": {
"@pulumi/query": "^0.3.0",
"callback-to-async-iterator": "^1.1.1",
"deasync": "^0.1.15",
"google-protobuf": "^3.5.0",
"grpc": "1.21.1",
......@@ -174,7 +173,7 @@
"semver": "^6.1.0",
"source-map-support": "^0.4.16",
"ts-node": "^7.0.0",
"typescript": "=3.6.3",
"typescript": "^3.0.0",
"upath": "^1.1.0"
},
"dependencies": {
......@@ -197,13 +196,6 @@
"requires": {
"@types/connect": "*",
"@types/node": "*"
},
"dependencies": {
"@types/node": {
"version": "12.12.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.7.tgz",
"integrity": "sha512-E6Zn0rffhgd130zbCbAr/JdXfXkoOUFAKNs/rF8qnafSJ8KYaA/j3oz7dcwal+lYjLA7xvdd5J4wdYpCTlP8+w=="
}
}
},
"@types/connect": {
......@@ -212,13 +204,6 @@
"integrity": "sha512-4r8qa0quOvh7lGD0pre62CAb1oni1OO6ecJLGCezTmhQ8Fz50Arx9RUszryR8KlgK6avuSXvviL6yWyViQABOg==",
"requires": {
"@types/node": "*"
},
"dependencies": {
"@types/node": {
"version": "12.12.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.7.tgz",
"integrity": "sha512-E6Zn0rffhgd130zbCbAr/JdXfXkoOUFAKNs/rF8qnafSJ8KYaA/j3oz7dcwal+lYjLA7xvdd5J4wdYpCTlP8+w=="
}
}
},
"@types/events": {
......@@ -227,9 +212,9 @@
"integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g=="
},
"@types/express": {
"version": "4.17.2",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.2.tgz",
"integrity": "sha512-5mHFNyavtLoJmnusB8OKJ5bshSzw+qkMIBAobLrIM48HJvunFva9mOa6aBwh64lBFyNwBbs0xiEFuj4eU/NjCA==",
"version": "4.17.1",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.1.tgz",
"integrity": "sha512-VfH/XCP0QbQk5B5puLqTLEeFgR8lfCJHZJKkInZ9mkYd+u8byX0kztXEQxEk4wZXJs8HI+7km2ALXjn4YKcX9w==",
"requires": {
"@types/body-parser": "*",
"@types/express-serve-static-core": "*",
......@@ -237,19 +222,12 @@
}
},
"@types/express-serve-static-core": {
"version": "4.16.11",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.16.11.tgz",
"integrity": "sha512-K8d2M5t3tBQimkyaYTXxtHYyoJPUEhy2/omVRnTAKw5FEdT+Ft6lTaTOpoJdHeG+mIwQXXtqiTcYZ6IR8LTzjQ==",
"version": "4.16.9",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.16.9.tgz",
"integrity": "sha512-GqpaVWR0DM8FnRUJYKlWgyARoBUAVfRIeVDZQKOttLFp5SmhhF9YFIYeTPwMd/AXfxlP7xVO2dj1fGu0Q+krKQ==",
"requires": {
"@types/node": "*",
"@types/range-parser": "*"
},
"dependencies": {
"@types/node": {
"version": "12.12.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.7.tgz",
"integrity": "sha512-E6Zn0rffhgd130zbCbAr/JdXfXkoOUFAKNs/rF8qnafSJ8KYaA/j3oz7dcwal+lYjLA7xvdd5J4wdYpCTlP8+w=="
}
}
},
"@types/glob": {
......@@ -260,13 +238,6 @@
"@types/events": "*",
"@types/minimatch": "*",
"@types/node": "*"
},
"dependencies": {
"@types/node": {
"version": "12.12.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.7.tgz",
"integrity": "sha512-E6Zn0rffhgd130zbCbAr/JdXfXkoOUFAKNs/rF8qnafSJ8KYaA/j3oz7dcwal+lYjLA7xvdd5J4wdYpCTlP8+w=="
}
}
},
"@types/js-yaml": {
......@@ -290,24 +261,16 @@