breezy-salesmen-85534
01/26/2021, 10:57 AMVipps.Vce.International.BlueGreen.Tests.BlueGreenStackTests.Test_BaseStack_Constructor_CreatesAKS.Test_BaseStack_Constructor_CreatesAKS(environment: uat, projectType: Green, name: "dv-uat-green-aks")
Pulumi.RunException: Running program '/Applications/Rider.app/Contents/lib/ReSharperHost/TestRunner/netcoreapp2.0/ReSharperTestRunner64.dll' failed wi...
Pulumi.RunException
Running program '/Applications/Rider.app/Contents/lib/ReSharperHost/TestRunner/netcoreapp2.0/ReSharperTestRunner64.dll' failed with an unhandled exception:
System.InvalidOperationException: This operation cannot be performed on a default instance of ImmutableArray<T>. Consider initializing the array, or checking the ImmutableArray<T>.IsDefault property.
at System.Collections.Immutable.ImmutableArray`1.ThrowInvalidOperationIfNotInitialized()
at System.Collections.Immutable.ImmutableArray`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
at System.Linq.Enumerable.SelectEnumerableIterator`2.ToArray()
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable`1 items)
at System.Collections.Immutable.ImmutableArray.ToImmutableArray[TSource](IEnumerable`1 items)
at Pulumi.Kubernetes.Yaml.Parser.<>c__DisplayClass2_0.<ParseYamlDocument>b__0(ImmutableArray`1 objs)
at Pulumi.Output`1.ApplyHelperAsync[U](Task`1 dataTask, Func`2 func)
at Pulumi.Output`1.ApplyHelperAsync[U](Task`1 dataTask, Func`2 func)
at Pulumi.Output`1.Pulumi.IOutput.GetDataAsync()
at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop, Boolean keepResources)
at Pulumi.Deployment.SerializeFilteredPropertiesAsync(String label, IDictionary`2 args, Predicate`1 acceptKey, Boolean keepResources)
at Pulumi.Deployment.SerializeAllPropertiesAsync(String label, IDictionary`2 args, Boolean keepResources)
at Pulumi.Deployment.RegisterResourceOutputsAsync(Resource resource, Output`1 outputs)
at Pulumi.Deployment.Runner.<>c__DisplayClass9_0.<<WhileRunningAsync>g__HandleCompletion|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Pulumi.Deployment.Runner.WhileRunningAsync()
at Pulumi.Deployment.TestAsync(IMocks mocks, Func`2 runAsync, TestOptions options)
at Vipps.Vce.International.BlueGreen.Tests.BlueGreenStackTests.Test_BaseStack_Constructor_CreatesAKS() in /Users/andreas.dreyer.hysing/code/vce/src/International.BlueGreen.Tests/BlueGreenStackTests.cs:line TAKEN OUT
at Xunit.Sdk.TestInvoker`1.<>c__DisplayClass48_1.<<InvokeTestMethodAsync>b__1>d.MoveNext() in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Runners\TestInvoker.cs:line 264
--- End of stack trace from previous location where exception was thrown ---
at Xunit.Sdk.ExecutionTimer.AggregateAsync(Func`1 asyncAction) in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\ExecutionTimer.cs:line 48
at Xunit.Sdk.ExceptionAggregator.RunAsync(Func`1 code) in C:\Dev\xunit\xunit\src\xunit.core\Sdk\ExceptionAggregator.cs:line 90
breezy-salesmen-85534
01/27/2021, 9:09 AMVipps.Vce.Core.Tests.K8s.KubernetesClusterTests.Test_Create_Cluster
Pulumi.RunException: Running program '/Applications/Rider.app/Contents/lib/ReSharperHost/TestRunner/netcoreapp2.0/ReSharperTestRunner64.dll' failed wi...
Pulumi.RunException
Running program '/Applications/Rider.app/Contents/lib/ReSharperHost/TestRunner/netcoreapp2.0/ReSharperTestRunner64.dll' failed with an unhandled exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Pulumi.Testing.MockMonitor.SerializeToDictionary(Object o)
at Pulumi.Testing.MockMonitor.RegisterResourceAsync(Resource resource, RegisterResourceRequest request)
at Pulumi.Deployment.RegisterResourceAsync(Resource resource, Boolean remote, Func`2 newDependency, ResourceArgs args, ResourceOptions options)
at Pulumi.Deployment.ReadOrRegisterResourceAsync(Resource resource, Boolean remote, Func`2 newDependency, ResourceArgs args, ResourceOptions options)
at Pulumi.Deployment.CompleteResourceAsync(Resource resource, Boolean remote, Func`2 newDependency, ResourceArgs args, ResourceOptions options, ImmutableDictionary`2 completionSources)
at Pulumi.Output`1.GetValueAsync()
at Pulumi.Deployment.Logger.TryGetResourceUrnAsync(Resource resource)
at Pulumi.Deployment.Runner.<>c__DisplayClass9_0.<<WhileRunningAsync>g__HandleCompletion|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Pulumi.Deployment.Runner.WhileRunningAsync()
at Pulumi.Deployment.TestAsync(IMocks mocks, Func`2 runAsync, TestOptions options)
at Vipps.Vce.Core.Tests.K8s.KubernetesClusterTests.CreateCluster() in /Users/andreas.dreyer.hysing/code/vce/src/Core.Tests/K8s/KubernetesClusterTests.cs:line 39
at Vipps.Vce.Core.Tests.K8s.KubernetesClusterTests.Test_Create_Cluster() in /Users/andreas.dreyer.hysing/code/vce/src/Core.Tests/K8s/KubernetesClusterTests.cs:line 48
at Xunit.Sdk.TestInvoker`1.<>c__DisplayClass48_1.<<InvokeTestMethodAsync>b__1>d.MoveNext() in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Runners\TestInvoker.cs:line 264
--- End of stack trace from previous location where exception was thrown ---
at Xunit.Sdk.ExecutionTimer.AggregateAsync(Func`1 asyncAction) in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\ExecutionTimer.cs:line 48
at Xunit.Sdk.ExceptionAggregator.RunAsync(Func`1 code) in C:\Dev\xunit\xunit\src\xunit.core\Sdk\ExceptionAggregator.cs:line 90
breezy-salesmen-85534
01/27/2021, 9:09 AMBlueGreenStack
, and provide as an example.
with Network Security Groups (NSGs), Role Based Access Control (RBAC), fluentd, in that stack I don’t think that is possible.
However today i tried setting up a single Kubernetes cluster as a mock in pulumi. I hade a similar issue. If I can get some input how to create KubernetesCluster , then I can probably fix my BlueGreenStack.
Here is thee example and the test tesult.
What can I to test this?
using Moq;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using Pulumi;
using Pulumi.Azure.ContainerService;
using Pulumi.Azure.ContainerService.Inputs;
using Pulumi.Testing;
using Xunit;
namespace Vipps.Vce.Core.Tests.K8s
{
public class KubernetesClusterStack : Stack
{
public KubernetesClusterStack()
{
KubernetesClusterArgs args = new KubernetesClusterArgs
{
DefaultNodePool = new KubernetesClusterDefaultNodePoolArgs
{
Name = "any node pool name",
VmSize = "any VM size"
},
DnsPrefix = "any string",
ResourceGroupName = "any string"
};
CustomResourceOptions options = new CustomResourceOptions();
var _ = new KubernetesCluster("foo", args, options);
}
}
public class KubernetesClusterTests
{
private async Task<KubernetesCluster> CreateCluster()
{
string projectName = "project";
string stackName = "project-blue";
var mocks = new Mock<IMocks>();
var deployment = await Deployment.TestAsync<KubernetesClusterStack>(mocks.Object,
new TestOptions {ProjectName = projectName, StackName = stackName});
return deployment.OfType<KubernetesCluster>().FirstOrDefault();
}
[Fact]
[Category("pulumi")]
public async Task Test_Create_Cluster()
{
var akscluster = await CreateCluster();
Assert.NotNull(akscluster);
}
}
}
And the related test resultwet-noon-14291
01/30/2021, 1:03 AMbrainy-ocean-92780
02/01/2021, 10:54 PMbrainy-ocean-92780
02/01/2021, 10:55 PMred-lighter-44012
02/02/2021, 7:01 AMResourceType.Get()
method variations to look up your resource by name.
Maybe this: https://www.pulumi.com/docs/reference/pkg/azure/sql/database/#look-up
But it requires a known resource ID. The more generic Get works with a name IIRC.tall-needle-56640
02/04/2021, 11:44 PMOutput.Create
possibly null?
private void DoSomething(ResourceGroup resourceGroup)
{
var test = resourceGroup.Name; // No null warning
var output = Output.Create(resourceGroup);
var test2 = resourceGroup.Name; // Possible null reference warning
}
able-rose-67471
02/11/2021, 9:17 AMKeyVault.Get()
method would work, since it requires the full resource ID (including the subscription segment). But when I try that, it returns "does not exist". Similarly, I've also tried the pulumi import
and that won't work either (I would have to switch subscriptions before running it, and then switch back after which results in the same "does not exist" message.
I thought I'd check on here before heading back to the drawing board as I fear I may have misunderstood the import capabilities!adamant-bird-10534
02/14/2021, 8:31 AMcurved-doctor-83600
02/16/2021, 11:01 AMValues =
{
{ "controller", new Dictionary<string,object>
{
{ "replicaCount", NodeCount },
{ "service", new Dictionary<string, object>
{
{ "externalTrafficPolicy", "local" },
{ "loadBalancerIP", staticIp }
}
}
}
}
}
wet-noon-14291
02/16/2021, 11:29 AMvar someVal = resource1.Id.Apply(id => { return GetSomeValue(); });
var resource2 = new SomeResource("name", SomeArgs({AValue = someVal}));
Am I guaranteed that someVal
will "resolve" after resource1
is done or is there another way to do this?numerous-artist-1705
02/17/2021, 12:24 PMPulumi.FSharp.Kubernetes
all should be working now. I'd appreciate if anyone could test it as I do not have any K8s cluster at the moment to use it.miniature-leather-70472
02/17/2021, 2:46 PMtall-needle-56640
02/25/2021, 5:46 PM"<http://github.com/pulumi/pulumi/pkg/testing/integration|github.com/pulumi/pulumi/pkg/testing/integration>"
, but I don't see an Integration
namespace in the NuGet package. As part of moving away from ARM to Pulumi, the team would like to see all integration tests still passing.wet-noon-14291
03/01/2021, 10:06 PMCustomResource
as a dependency but it should only return created when one or more of the resources it wraps are done? Pseudo example:
MyCustomResource: CustomResource {
var resourceA = new A();
var resourceB = new B();
var resourceC = new C();
}
Deploy {
var myResource = new MyCustomResource();
var someOtherResournce = new SomeOtherResource({ dependsOn = [myResource]);
}
In the dependsOn
there, is it possible to have that resource to delegate the check to one or more of resourceA, resourceB or resourceC?
I think that is what causing one of our deploy to fail now since we "wrap" a kubernetes deployment, but the dependency is to our CustomResource
and not to the actual deployment.magnificent-television-29869
03/10/2021, 11:09 AMmagnificent-television-29869
03/10/2021, 11:09 AMmagnificent-television-29869
03/16/2021, 9:50 AMmagnificent-television-29869
03/16/2021, 2:02 PMazure-native:cdn:CustomDomain (abc-de.fgh.ijk.lm):
error: Preview failed: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="Property 'CustomDomainEntityKey.CustomDomainName' cannot be set to 'abc-de.fgh.ijk.lm'
the code I am running is
return new CustomDomain(fqdn, new CustomDomainArgs()
{
EndpointName = cdnEndpoint.Name,
ProfileName = cdnProfile.Name,
HostName = fqdn,
ResourceGroupName = resourceGroup.Name,
CustomDomainName = fqdn
});
What am I doing wrong ?magnificent-television-29869
03/17/2021, 8:32 AMaverage-dinner-84543
03/17/2021, 1:42 PMcreamy-crowd-26033
03/17/2021, 6:07 PMaverage-spoon-16995
03/18/2021, 8:14 AMIdentity = new AzureNative.ContainerService.Inputs.ManagedClusterIdentityArgs
{
Type = AzureNative.ContainerService.ResourceIdentityType.UserAssigned,
UserAssignedIdentities = {
{ $"/subscriptions/(i have my sub id here)/resourcegroups/rg-aks-pulumi-fabio9d58994b/providers/Microsoft.ManagedIdentity/userAssignedIdentities/fabio-Test", "" }
}
},
error: Code="FailedIdentityOperation" Message="Identity operation for resource '/subscriptions/(here to)/resourceGroups/rg-aks-pulumi-fabio9d58994b/providers/Microsoft.ContainerService/managedClusters/aks-test38e10d3d' failed with error 'Failed to perform resource identity operation. Status: 'BadRequest'. Response: '{\"error\":{\"code\":\"BadRequest\",\"message\":\"Resource name Request does not support null for removing assigned identities. is invalid for user assigned identity.\"}}'.'."
average-spoon-16995
03/18/2021, 8:17 AMIdentity = new AzureNative.ContainerService.Inputs.ManagedClusterIdentityArgs
{
Type = "UserAssigned",
UserAssignedIdentities =
{
{ "/subscriptions/subid1/resourceGroups/rgName1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", },
},
},
astonishing-monitor-96741
03/23/2021, 5:03 PMnew Docker.Image(new Docker.ImageArgs { Build = new Docker.DockerBuild....
commands to build 4 different images and frequently (not always) have it throw an error during pulumi up:
Executing ' docker login'
Executing ' docker login'
Executing ' docker login'
Executing ' docker login'
Login Succeeded
Login Succeeded
Login Succeeded
warning: WARNING! Your password will be stored unencrypted in C:\Users\AzDevOps.vmss000026\.docker\config.json.Configure a credential helper to remove this warning. See<https://docs.docker.com/engine/reference/commandline/login/#credentials-store>
error: WARNING! Your password will be stored unencrypted in C:\Users\AzDevOps.vmss000026\.docker\config.json.Configure a credential helper to remove this warning. See<https://docs.docker.com/engine/reference/commandline/login/#credentials-storeError> saving credentials: rename C:\Users\AzDevOps.vmss000026\.docker\config.json866015259 C:\Users\AzDevOps.vmss000026\.docker\config.json: Access is denied.
warning: WARNING! Your password will be stored unencrypted in C:\Users\AzDevOps.vmss000026\.docker\config.json.Configure a credential helper to remove this warning. See<https://docs.docker.com/engine/reference/commandline/login/#credentials-store>
' docker login' failed with exit code 1
warning: WARNING! Your password will be stored unencrypted in C:\Users\AzDevOps.vmss000026\.docker\config.json.Configure a credential helper to remove this warning. See<https://docs.docker.com/engine/reference/commandline/login/#credentials-store>
So 1 of the 4 above has issues writing to the warning temp docker config file, I'm assuming at the same time.flat-mouse-20634
03/29/2021, 8:01 AMvar resourceGroup = new ResourceGroup("mystaticsite");
var storageAccount = new StorageAccount("mysite", new StorageAccountArgs
{
ResourceGroupName = resourceGroup.Name,
EnableHttpsTrafficOnly = true,
Sku = new SkuArgs
{
Name = SkuName.Standard_LRS
},
AccessTier = AccessTier.Hot,
Kind = Kind.StorageV2,
});
PrimaryWebEndpoint = storageAccount.PrimaryEndpoints.Apply(x=>x.Web);
My test is trying to verify that the ResourceGroup was created
private static Task<ImmutableArray<Pulumi.Resource>> TestAsync()
{
return Pulumi.Deployment.TestAsync<WebsiteStack>(new Mocks(), new TestOptions {IsPreview = false});
}
[Fact]
public async Task ResourceGroup_ShouldExist()
{
var resources = await TestAsync();
var resourceGroups = resources.OfType<ResourceGroup>().ToList();
resourceGroups.Count.ShouldBe(1);
}
I couldn’t get the test to pass because I can’t find a way to mock EndpointsResponse
Are there a recommended way to handle this scenario?chilly-hairdresser-56259
03/31/2021, 9:33 PMpurple-train-14007
03/31/2021, 11:02 PMtall-needle-56640
04/01/2021, 4:22 PMforeach (var element in Environment.GetEnvironmentVariables())
{
if (element is KeyValuePair<string, object> pair
&& pair.Value is string valueStr)
env[pair.Key] = valueStr;
}
Environment.GetEnvironmentVariables
returns an IDictionary
. Ideally, it would be typed, but generics probably hadn't been introduced yet. I think it's obvious that it should actually return IDictionary<string, string?>
, but in case of any doubt Environment.GetEnvironmentVariable(string)
only returns string?
, not object
. So what value does element is KeyValuePair<string, object>
give us?
Therefore, couldn't the code be simplified to
foreach (var pair in Environment.GetEnvironmentVariables())
{
if (pair.Value is string valueStr)
env[pair.Key] = valueStr;
}
@bored-oyster-3147tall-needle-56640
04/01/2021, 4:22 PMforeach (var element in Environment.GetEnvironmentVariables())
{
if (element is KeyValuePair<string, object> pair
&& pair.Value is string valueStr)
env[pair.Key] = valueStr;
}
Environment.GetEnvironmentVariables
returns an IDictionary
. Ideally, it would be typed, but generics probably hadn't been introduced yet. I think it's obvious that it should actually return IDictionary<string, string?>
, but in case of any doubt Environment.GetEnvironmentVariable(string)
only returns string?
, not object
. So what value does element is KeyValuePair<string, object>
give us?
Therefore, couldn't the code be simplified to
foreach (var pair in Environment.GetEnvironmentVariables())
{
if (pair.Value is string valueStr)
env[pair.Key] = valueStr;
}
@bored-oyster-3147bored-oyster-3147
04/01/2021, 4:25 PMpair.Key
is string
at compile-time so env[pair.key] = ...;
might give you an error?tall-needle-56640
04/01/2021, 4:44 PMobject
and not string
.bored-oyster-3147
04/01/2021, 5:17 PMelement
is of type System.Collection.DictionaryEntry?
.
And none of them satisfied KeyValuePair<string, object>
, KeyValuePair<string, string>
, or KeyValuePair<string, string?>
... which is concerning
I actually had to do this to get working:
var env = Environment.GetEnvironmentVariables();
foreach (DictionaryEntry? element in env)
{
if (element is null || !element.HasValue)
continue;
if (element.Value.Key is string keyStr
&& element.Value.Value != null
&& element.Value.Value is string valueStr)
Console.WriteLine($"[{keyStr}] = {valueStr}");
}
is KeyValuePair<string, object>
check might never be satisfied currentlyprehistoric-coat-10166
04/01/2021, 5:25 PMSystem.GetEnvironmentVariables
foreach (DictionaryEntry entry in Environment.GetEnvironmentVariables())
should do the trick and then checking the key & valuebored-oyster-3147
04/01/2021, 5:26 PMtall-needle-56640
04/01/2021, 5:29 PMelement.Value.Value != null
&& element.Value.Value is string valueStr
bored-oyster-3147
04/01/2021, 5:31 PMprehistoric-coat-10166
04/01/2021, 5:33 PMif (element.Value.Key is string keyString
&& element.Value.Value is string valueString)
{
env[keyString] = valueString;
}
Should work (with the element null check)enough-garden-22763
04/01/2021, 5:38 PMbored-oyster-3147
04/01/2021, 5:45 PMprehistoric-coat-10166
04/01/2021, 5:46 PMValueWhichMayBeNull ?? ""
Process
https://github.com/dotnet/runtime/issues/34446