private async Task InstallWorkloadsOnScaleUnit()
        {
            await EnsureClientInitialized();

            await ReliableRun.Execute(async() =>
            {
                AOSClient hubAosClient = await AOSClient.Construct(Config.HubScaleUnit().ResourceId(), Config.HubScaleUnit().Endpoint());

                List <WorkloadInstance> workloadInstances = await new WorkloadInstanceManager(hubAosClient).CreateWorkloadInstances();

                foreach (var workloadInstance in workloadInstances)
                {
                    if (await WorkloadInstanceManager.IsWorkloadInstanceInReadyState(scaleUnitAosClient, workloadInstance))
                    {
                        continue;
                    }

                    if (!await WorkloadInstanceManager.IsWorkloadInstanceInInstallingState(scaleUnitAosClient, workloadInstance))
                    {
                        Console.WriteLine($"Installing the {workloadInstance.VersionedWorkload.Workload.Name} workload");
                        List <WorkloadInstance> workloadInstanceToInstallList = new List <WorkloadInstance>()
                        {
                            workloadInstance
                        };
                        await scaleUnitAosClient.WriteWorkloadInstances(workloadInstanceToInstallList);
                    }

                    if (AxDeployment.IsApplicationVersionMoreRecentThan("10.8.581.0"))
                    {
                        await WaitForWorkloadInstallation(workloadInstance);
                    }
                }
            }, "Install workload on scale unit");
        }
Exemple #2
0
        public void IsApplicationVersionMoreRecentThan_WithEqualVersion_ReturnsFalse()
        {
            // Arrange
            AxDeploymentTestable.SetApplicationVersion("10.8.107.1233");

            // Act + Assert
            AxDeployment.IsApplicationVersionMoreRecentThan("10.8.107.1233").Should().BeFalse();
        }
Exemple #3
0
        public void IsApplicationVersionMoreRecentThan_WithPreviousVersion_ReturnsTrue()
        {
            // Arrange
            AxDeploymentTestable.SetApplicationVersion("10.8.107.1233");

            // Act + Assert
            AxDeployment.IsApplicationVersionMoreRecentThan("10.8.107.1232").Should().BeTrue();
            AxDeployment.IsApplicationVersionMoreRecentThan("10.8.106.1333").Should().BeTrue();
            AxDeployment.IsApplicationVersionMoreRecentThan("10.7.120.1230").Should().BeTrue();
            AxDeployment.IsApplicationVersionMoreRecentThan("9.1000.1.1234").Should().BeTrue();
        }