Exemple #1
0
        private static async Task BreakStuff(IApprendaApiClient client, EnrichedApplication getRes, ICollection <TimeSpan> timeTaken)
        {
            var start = DateTime.UtcNow;

            var versions = (await client.GetVersionsForApplication(getRes.Alias)).ToList();

            Assert.NotNull(versions);

            //get the compoenents and other stuff
            //this may 404
            try
            {
                var comps = (await client.GetComponents(getRes.Alias, getRes.CurrentVersion?.Alias)).ToList();
                Assert.NotNull(comps);
            }
            catch (Exception e)
            {
                //validate is 404
                var i = 5;
            }

            var time = DateTime.UtcNow - start;

            timeTaken.Add(time);
        }
        public static bool IsInStage(this EnrichedApplication app, string desiredState)
        {
            if (app == null)
            {
                //throw new ArgumentException("Application is null!");
                return(false);
            }

            if (app.CurrentVersion == null)
            {
                //throw new ArgumentException($"Current version of application ${app.Alias} is null");
                return(false);
            }

            if (string.IsNullOrWhiteSpace(app.CurrentVersion.Stage))
            {
                //throw new ArgumentException($"No stage listed for version ${app.CurrentVersion.Alias} of application {app.Alias}");
                return(false);
            }

            return(string.Equals(app.CurrentVersion.Stage, desiredState, StringComparison.CurrentCultureIgnoreCase));
        }
 public static bool IsCurrentlyPromoting(this EnrichedApplication app)
 {
     return(app.IsInStage("promoting") || app.IsInStage("started"));
 }