Housekeeping (#8)
* Rename the provider to dockerbuild. * Add Makefile targets required by CI. * Add per-language test targets compatible with CI. * Fix broken example yaml. * Add gitignore exclusions to fix SDK generation in CI. * Fix lint errors. * Vendor pulumi CLI via `tools.go` instead of `.pulumi`. * Consolidate `go.mod`s into one file, with a minimal `go.mod` for the Go SDK. * Add codecov.
This commit is contained in:
@@ -17,8 +17,8 @@ package main
|
||||
import (
|
||||
p "github.com/pulumi/pulumi-go-provider"
|
||||
|
||||
xyz "github.com/pulumi/pulumi-docker-native/provider"
|
||||
xyz "github.com/pulumi/pulumi-dockerbuild/provider"
|
||||
)
|
||||
|
||||
// Serve the provider against Pulumi's Provider protocol.
|
||||
func main() { p.RunProvider(xyz.Name, xyz.Version, xyz.Provider()) }
|
||||
func main() { _ = p.RunProvider(xyz.Name, xyz.Version, xyz.Provider()) }
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "dockerbuild",
|
||||
"displayName": "docker",
|
||||
"version": "0.0.1-alpha.1710800081+042bd882.dirty",
|
||||
"version": "0.0.1-alpha.1710805517+1af3a9ed.dirty",
|
||||
"description": "Description",
|
||||
"keywords": [
|
||||
"keywords"
|
||||
@@ -14,12 +14,42 @@
|
||||
"moduleFormat": "(.*)"
|
||||
},
|
||||
"language": {
|
||||
"csharp": {
|
||||
"packageReferences": {
|
||||
"Pulumi": "3.*"
|
||||
}
|
||||
},
|
||||
"go": {
|
||||
"importBasePath": "github.com/pulumi/pulumi-dockerbuild/sdk/go/docker",
|
||||
"packageImportAliases": {
|
||||
"github.com/pulumi/pulumi-dockerbuild/sdk/go/docker": "docker"
|
||||
},
|
||||
"generateResourceContainerTypes": true,
|
||||
"generics": "generics-only"
|
||||
},
|
||||
"java": {
|
||||
"basePackage": "",
|
||||
"buildFiles": "gradle",
|
||||
"dependencies": {
|
||||
"com.google.code.findbugs:jsr305": "3.0.2",
|
||||
"com.google.code.gson:gson": "2.8.9",
|
||||
"com.pulumi:pulumi": "0.9.9"
|
||||
},
|
||||
"gradleNexusPublishPluginVersion": "1.1.0",
|
||||
"gradleTest": ""
|
||||
},
|
||||
"nodejs": {
|
||||
"dependencies": {
|
||||
"@pulumi/pulumi": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"python": {
|
||||
"requires": {
|
||||
"pulumi": "\u003e=3.0.0,\u003c4.0.0"
|
||||
},
|
||||
"pyproject": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {},
|
||||
|
||||
193
provider/go.mod
193
provider/go.mod
@@ -1,193 +0,0 @@
|
||||
module github.com/pulumi/pulumi-docker-native/provider
|
||||
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/pulumi/pulumi-go-provider v0.14.1-0.20240301190400-aeddefa8dc54
|
||||
github.com/pulumi/pulumi/pkg/v3 v3.107.0
|
||||
github.com/pulumi/pulumi/sdk/v3 v3.107.0
|
||||
)
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.110.10 // indirect
|
||||
cloud.google.com/go/compute v1.23.3 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.2.3 // indirect
|
||||
cloud.google.com/go/iam v1.1.5 // indirect
|
||||
cloud.google.com/go/kms v1.15.5 // indirect
|
||||
cloud.google.com/go/logging v1.8.1 // indirect
|
||||
cloud.google.com/go/longrunning v0.5.4 // indirect
|
||||
cloud.google.com/go/storage v1.35.1 // indirect
|
||||
dario.cat/mergo v1.0.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/keyvault/azkeys v0.10.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.1 // indirect
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.0 // indirect
|
||||
github.com/Microsoft/go-winio v0.6.1 // indirect
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
|
||||
github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect
|
||||
github.com/agext/levenshtein v1.2.3 // indirect
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
|
||||
github.com/armon/go-metrics v0.4.0 // indirect
|
||||
github.com/armon/go-radix v1.0.0 // indirect
|
||||
github.com/atotto/clipboard v0.1.4 // indirect
|
||||
github.com/aws/aws-sdk-go v1.49.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2 v1.24.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/config v1.26.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.16.12 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.10 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.9 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.9 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.7.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.9 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/kms v1.27.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.18.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.26.5 // indirect
|
||||
github.com/aws/smithy-go v1.19.0 // indirect
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||
github.com/blang/semver v3.5.1+incompatible // indirect
|
||||
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
|
||||
github.com/charmbracelet/bubbles v0.16.1 // indirect
|
||||
github.com/charmbracelet/bubbletea v0.24.2 // indirect
|
||||
github.com/charmbracelet/lipgloss v0.7.1 // indirect
|
||||
github.com/cheggaaa/pb v1.0.29 // indirect
|
||||
github.com/cloudflare/circl v1.3.7 // indirect
|
||||
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
|
||||
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/deckarep/golang-set/v2 v2.5.0 // indirect
|
||||
github.com/djherbis/times v1.5.0 // indirect
|
||||
github.com/edsrzf/mmap-go v1.1.0 // indirect
|
||||
github.com/emirpasic/gods v1.18.1 // indirect
|
||||
github.com/fatih/color v1.13.0 // indirect
|
||||
github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813 // indirect
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.5.0 // indirect
|
||||
github.com/go-git/go-git/v5 v5.11.0 // indirect
|
||||
github.com/gofrs/uuid v4.3.1+incompatible // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.1.0 // indirect
|
||||
github.com/golang/glog v1.1.2 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/go-querystring v1.1.0 // indirect
|
||||
github.com/google/s2a-go v0.1.7 // indirect
|
||||
github.com/google/uuid v1.4.0 // indirect
|
||||
github.com/google/wire v0.5.0 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
|
||||
github.com/gorilla/mux v1.8.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-hclog v1.2.2 // indirect
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-plugin v1.4.6 // indirect
|
||||
github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
|
||||
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
|
||||
github.com/hashicorp/go-secure-stdlib/mlock v0.1.2 // indirect
|
||||
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 // indirect
|
||||
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
|
||||
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
|
||||
github.com/hashicorp/go-uuid v1.0.3 // indirect
|
||||
github.com/hashicorp/go-version v1.6.0 // indirect
|
||||
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/hashicorp/hcl/v2 v2.18.0 // indirect
|
||||
github.com/hashicorp/vault/api v1.8.2 // indirect
|
||||
github.com/hashicorp/vault/sdk v0.6.1 // indirect
|
||||
github.com/hashicorp/yamux v0.1.1 // indirect
|
||||
github.com/iancoleman/strcase v0.2.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||
github.com/kylelemons/godebug v1.1.0 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.12 // indirect
|
||||
github.com/mattn/go-isatty v0.0.19 // indirect
|
||||
github.com/mattn/go-localereader v0.0.1 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
||||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/go-ps v1.0.0 // indirect
|
||||
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
|
||||
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
|
||||
github.com/muesli/cancelreader v0.2.2 // indirect
|
||||
github.com/muesli/reflow v0.3.0 // indirect
|
||||
github.com/muesli/termenv v0.15.2 // indirect
|
||||
github.com/natefinch/atomic v1.0.1 // indirect
|
||||
github.com/oklog/run v1.1.0 // indirect
|
||||
github.com/opentracing/basictracer-go v1.1.0 // indirect
|
||||
github.com/opentracing/opentracing-go v1.2.0 // indirect
|
||||
github.com/pgavlin/fx v0.1.6 // indirect
|
||||
github.com/pgavlin/goldmark v1.1.33-0.20200616210433-b5eb04559386 // indirect
|
||||
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
|
||||
github.com/pjbgf/sha1cd v0.3.0 // indirect
|
||||
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pkg/term v1.1.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/pulumi/appdash v0.0.0-20231130102222-75f619a67231 // indirect
|
||||
github.com/pulumi/esc v0.6.2 // indirect
|
||||
github.com/rivo/uniseg v0.4.4 // indirect
|
||||
github.com/rogpeppe/go-internal v1.11.0 // indirect
|
||||
github.com/ryanuber/go-glob v1.0.0 // indirect
|
||||
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect
|
||||
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect
|
||||
github.com/segmentio/asm v1.2.0 // indirect
|
||||
github.com/segmentio/encoding v0.3.6 // indirect
|
||||
github.com/sergi/go-diff v1.3.1 // indirect
|
||||
github.com/skeema/knownhosts v1.2.1 // indirect
|
||||
github.com/spf13/afero v1.9.5 // indirect
|
||||
github.com/spf13/cobra v1.7.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/stretchr/testify v1.8.4 // indirect
|
||||
github.com/texttheater/golang-levenshtein v1.0.1 // indirect
|
||||
github.com/tweekmonster/luser v0.0.0-20161003172636-3fa38070dbd7 // indirect
|
||||
github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect
|
||||
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
github.com/zclconf/go-cty v1.14.0 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
go.uber.org/atomic v1.11.0 // indirect
|
||||
gocloud.dev v0.36.0 // indirect
|
||||
gocloud.dev/secrets/hashivault v0.27.0 // indirect
|
||||
golang.org/x/crypto v0.17.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
|
||||
golang.org/x/mod v0.14.0 // indirect
|
||||
golang.org/x/net v0.19.0 // indirect
|
||||
golang.org/x/oauth2 v0.14.0 // indirect
|
||||
golang.org/x/sync v0.5.0 // indirect
|
||||
golang.org/x/sys v0.15.0 // indirect
|
||||
golang.org/x/term v0.15.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
golang.org/x/time v0.4.0 // indirect
|
||||
golang.org/x/tools v0.15.0 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
|
||||
google.golang.org/api v0.151.0 // indirect
|
||||
google.golang.org/appengine v1.6.8 // indirect
|
||||
google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
|
||||
google.golang.org/grpc v1.59.0 // indirect
|
||||
google.golang.org/protobuf v1.31.0 // indirect
|
||||
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
lukechampine.com/frand v1.4.2 // indirect
|
||||
)
|
||||
2636
provider/go.sum
2636
provider/go.sum
File diff suppressed because it is too large
Load Diff
@@ -21,36 +21,68 @@ import (
|
||||
p "github.com/pulumi/pulumi-go-provider"
|
||||
"github.com/pulumi/pulumi-go-provider/infer"
|
||||
"github.com/pulumi/pulumi-go-provider/middleware/schema"
|
||||
gen "github.com/pulumi/pulumi/pkg/v3/codegen/go"
|
||||
"github.com/pulumi/pulumi-java/pkg/codegen/java"
|
||||
csgen "github.com/pulumi/pulumi/pkg/v3/codegen/dotnet"
|
||||
gogen "github.com/pulumi/pulumi/pkg/v3/codegen/go"
|
||||
tsgen "github.com/pulumi/pulumi/pkg/v3/codegen/nodejs"
|
||||
pygen "github.com/pulumi/pulumi/pkg/v3/codegen/python"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/tokens"
|
||||
)
|
||||
|
||||
// Version is initialized by the Go linker to contain the semver of this build.
|
||||
var Version string
|
||||
|
||||
const Name string = "docker-native" // Needs to match $PACK in Makefile.
|
||||
const Name string = "dockerbuild" // Needs to match $PACK in Makefile.
|
||||
|
||||
func Provider() p.Provider {
|
||||
// We tell the provider what resources it needs to support.
|
||||
// In this case, a single custom resource.
|
||||
return infer.Provider(infer.Options{
|
||||
Metadata: schema.Metadata{
|
||||
DisplayName: "docker",
|
||||
DisplayName: "dockerbuild",
|
||||
LanguageMap: map[string]any{
|
||||
"go": gen.GoPackageInfo{
|
||||
Generics: gen.GenericsSettingGenericsOnly,
|
||||
"go": gogen.GoPackageInfo{
|
||||
// GenerateResourceContainerTypes: true,
|
||||
Generics: gogen.GenericsSettingGenericsOnly,
|
||||
PackageImportAliases: map[string]string{
|
||||
"github.com/pulumi/pulumi-docker-native/sdk/go/docker": "docker",
|
||||
"github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild": "dockerbuild",
|
||||
},
|
||||
ImportBasePath: "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild",
|
||||
},
|
||||
"csharp": csgen.CSharpPackageInfo{
|
||||
PackageReferences: map[string]string{
|
||||
"Pulumi": "3.*",
|
||||
},
|
||||
},
|
||||
"java": java.PackageInfo{
|
||||
BuildFiles: "gradle",
|
||||
GradleNexusPublishPluginVersion: "1.1.0",
|
||||
Dependencies: map[string]string{
|
||||
"com.pulumi:pulumi": "0.9.9",
|
||||
"com.google.code.gson:gson": "2.8.9",
|
||||
"com.google.code.findbugs:jsr305": "3.0.2",
|
||||
},
|
||||
},
|
||||
"nodejs": tsgen.NodePackageInfo{
|
||||
Dependencies: map[string]string{
|
||||
"@pulumi/pulumi": "^3.0.0",
|
||||
},
|
||||
},
|
||||
"python": pygen.PackageInfo{
|
||||
PyProject: struct {
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
}{Enabled: true},
|
||||
Requires: map[string]string{
|
||||
"pulumi": ">=3.0.0,<4.0.0",
|
||||
},
|
||||
ImportBasePath: "github.com/pulumi/pulumi-docker-native/sdk/go/docker",
|
||||
},
|
||||
},
|
||||
Description: "Description",
|
||||
Keywords: []string{"keywords"},
|
||||
Homepage: "pulumi.com",
|
||||
Publisher: "pulumi",
|
||||
Repository: "https://github.com/pulumi/pulumi-docker-native",
|
||||
PluginDownloadURL: "github.com/pulumi/pulumi-docker-native",
|
||||
Repository: "https://github.com/pulumi/pulumi-dockerbuild",
|
||||
PluginDownloadURL: "github.com/pulumi/pulumi-dockerbuild",
|
||||
},
|
||||
Resources: []infer.InferredResource{
|
||||
infer.Resource[Random, RandomArgs, RandomState](),
|
||||
@@ -86,7 +118,7 @@ type RandomState struct {
|
||||
// It is generally a good idea to embed args in outputs, but it isn't strictly necessary.
|
||||
RandomArgs
|
||||
// Here we define a required output called result.
|
||||
Result string `pulumi:"result"`
|
||||
Result string `pulumi:"result" provider:"output"`
|
||||
}
|
||||
|
||||
// All resources must implement Create at a minimum.
|
||||
@@ -100,7 +132,7 @@ func (Random) Create(ctx p.Context, name string, input RandomArgs, preview bool)
|
||||
}
|
||||
|
||||
func makeRandom(length int) string {
|
||||
seededRand := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
seededRand := rand.New(rand.NewSource(time.Now().UnixNano())) //nolint: gosec
|
||||
charset := []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
|
||||
|
||||
result := make([]rune, length)
|
||||
|
||||
57
provider/provider_test.go
Normal file
57
provider/provider_test.go
Normal file
@@ -0,0 +1,57 @@
|
||||
// Copyright 2016-2023, Pulumi Corporation.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package provider
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/blang/semver"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
p "github.com/pulumi/pulumi-go-provider"
|
||||
"github.com/pulumi/pulumi-go-provider/integration"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/tokens"
|
||||
)
|
||||
|
||||
func TestRandomCreate(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
prov := provider()
|
||||
|
||||
response, err := prov.Create(p.CreateRequest{
|
||||
Urn: urn("Random"),
|
||||
Properties: resource.PropertyMap{
|
||||
"length": resource.NewNumberProperty(12),
|
||||
},
|
||||
Preview: false,
|
||||
})
|
||||
|
||||
require.NoError(t, err)
|
||||
result := response.Properties["result"].StringValue()
|
||||
assert.Len(t, result, 12)
|
||||
}
|
||||
|
||||
// urn is a helper function to build an urn for running integration tests.
|
||||
func urn(typ string) resource.URN {
|
||||
return resource.NewURN("stack", "proj", "",
|
||||
tokens.Type("test:index:"+typ), "name")
|
||||
}
|
||||
|
||||
// Create a test server.
|
||||
func provider() integration.Server {
|
||||
return integration.NewServer(Name, semver.MustParse("1.0.0"), Provider())
|
||||
}
|
||||
Reference in New Issue
Block a user