예제 #1
0
        static async Task TearDown()
        {
            using (var fabric = new FabricClient())
            {
                var app          = fabric.ApplicationManager;
                var applications = await fabric.QueryManager.GetApplicationListAsync(ApplicationName).ConfigureAwait(false);

                if (applications.Any())
                {
                    await app.DeleteApplicationAsync(new DeleteApplicationDescription(ApplicationName)).ConfigureAwait(false);

                    await app.UnprovisionApplicationAsync(ApplicationTypeName, ApplicationTypeVersion.ToString()).ConfigureAwait(false);

                    app.RemoveApplicationPackage(imageStoreConnectionString, ImageStorePath.ToString());
                }

                var applicationTypes = await fabric.QueryManager.GetApplicationTypeListAsync(ApplicationTypeName);

                if (applicationTypes.Any())
                {
                    await app.UnprovisionApplicationAsync(ApplicationTypeName, ApplicationTypeVersion.ToString()).ConfigureAwait(false);
                }
            }
        }
예제 #2
0
        static async Task SetUp()
        {
            if (testRunner == null)
            {
                using (var fabric = new FabricClient())
                {
                    var clusterManifest = await GetClusterManifest(fabric).ConfigureAwait(false);

                    imageStoreConnectionString = clusterManifest["Management"]["ImageStoreConnectionString"];
                    await TearDown().ConfigureAwait(false);

                    var app = fabric.ApplicationManager;
                    app.CopyApplicationPackage(imageStoreConnectionString, TestAppPkgPath, ImageStorePath.ToString());
                    await app.ProvisionApplicationAsync(ImageStorePath.ToString()).ConfigureAwait(false);

                    var nameValueCollection = new NameValueCollection();
                    // currently hardcoded
                    foreach (var toPromote in environmentVariablesToPromote)
                    {
                        var value = Environment.GetEnvironmentVariable(toPromote);
                        nameValueCollection[$"{TypeName}_{toPromote}"] = value;
                    }
                    await app.CreateApplicationAsync(new ApplicationDescription(ApplicationName, ApplicationTypeName, ApplicationTypeVersion.ToString(), nameValueCollection)).ConfigureAwait(false);
                }

                testRunner = ServiceProxy.Create <ITestRunner>(ServiceUri);
            }
        }
        static async Task SetUp(CancellationToken cancellationToken = default)
        {
            if (testRunner == null)
            {
                using (var fabric = new FabricClient())
                {
                    var clusterManifest = await GetClusterManifest(fabric, cancellationToken).ConfigureAwait(false);

                    imageStoreConnectionString = clusterManifest["Management"]["ImageStoreConnectionString"];
                    await TearDown(cancellationToken).ConfigureAwait(false);

                    var app   = fabric.ApplicationManager;
                    var store = ImageStorePath.ToString();
                    Console.WriteLine("CopyApplicationPackage. imageStoreConnectionString:" + imageStoreConnectionString + ". TestAppPkgPath:" + TestAppPkgPath + ". store:" + store);
                    app.CopyApplicationPackage(imageStoreConnectionString, TestAppPkgPath, store);
                    await app.ProvisionApplicationAsync(store).ConfigureAwait(false);

                    var nameValueCollection = new NameValueCollection();
                    // currently hardcoded
                    foreach (var toPromote in environmentVariablesToPromote)
                    {
                        var value = Environment.GetEnvironmentVariable(toPromote);
                        nameValueCollection[$"Tests_{toPromote}"] = value;
                    }
                    await app.CreateApplicationAsync(new ApplicationDescription(ApplicationName, ApplicationTypeName, ApplicationTypeVersion.ToString(), nameValueCollection)).ConfigureAwait(false);
                }

                testRunner = ServiceProxy.Create <ITestRunner>(ServiceUri);
            }
        }