Dynamic provider test
This commit is contained in:
parent
d7ec7ce06c
commit
e20ffbebba
3
tests/integration/dynamic/dotnet/.gitignore
vendored
Normal file
3
tests/integration/dynamic/dotnet/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
/.pulumi/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
8
tests/integration/dynamic/dotnet/Dynamic.csproj
Normal file
8
tests/integration/dynamic/dotnet/Dynamic.csproj
Normal file
|
@ -0,0 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
32
tests/integration/dynamic/dotnet/Program.cs
Normal file
32
tests/integration/dynamic/dotnet/Program.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
// Copyright 2016-2019, Pulumi Corporation. All rights reserved.
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Pulumi;
|
||||
|
||||
//import binascii
|
||||
//import os
|
||||
//from pulumi import ComponentResource, export
|
||||
//from pulumi.dynamic import Resource, ResourceProvider, CreateResult//
|
||||
|
||||
//class RandomResourceProvider(ResourceProvider):
|
||||
// def create(self, props):
|
||||
// val = binascii.b2a_hex(os.urandom(15)).decode("ascii")
|
||||
// return CreateResult(val, { "val": val })//
|
||||
|
||||
//class Random(Resource):
|
||||
// val: str
|
||||
// def __init__(self, name, opts = None):
|
||||
// super().__init__(RandomResourceProvider(), name, {"val": ""}, opts)//
|
||||
|
||||
//r = Random("foo")//
|
||||
|
||||
//export("random_id", r.id)
|
||||
//export("random_val", r.val)
|
||||
|
||||
class Program
|
||||
{
|
||||
static Task<int> Main(string[] args)
|
||||
{
|
||||
return Deployment.RunAsync(() => {});
|
||||
}
|
||||
}
|
3
tests/integration/dynamic/dotnet/Pulumi.yaml
Normal file
3
tests/integration/dynamic/dotnet/Pulumi.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
name: dynamic_dotnet
|
||||
description: A simple dotnet program that uses dynamic providers.
|
||||
runtime: dotnet
|
1
tests/integration/dynamic/dotnet/step1/README.md
Normal file
1
tests/integration/dynamic/dotnet/step1/README.md
Normal file
|
@ -0,0 +1 @@
|
|||
Intentionally make no changes.
|
|
@ -591,3 +591,22 @@ func TestAboutDotnet(t *testing.T) {
|
|||
// This one doesn't have a current stack. Assert that we caught it.
|
||||
assert.Contains(t, stderr, "No current stack")
|
||||
}
|
||||
|
||||
// Tests dynamic provider in Dotnet.
|
||||
func TestDynamicDotnet(t *testing.T) {
|
||||
var randomVal string
|
||||
integration.ProgramTest(t, &integration.ProgramTestOptions{
|
||||
Dir: filepath.Join("dynamic", "dotnet"),
|
||||
Dependencies: []string{"Pulumi"},
|
||||
ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
|
||||
randomVal = stack.Outputs["random_val"].(string)
|
||||
},
|
||||
EditDirs: []integration.EditDir{{
|
||||
Dir: "step1",
|
||||
Additive: true,
|
||||
ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
|
||||
assert.Equal(t, randomVal, stack.Outputs["random_val"].(string))
|
||||
},
|
||||
}},
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue