예제 #1
0
        public void ExecuteFeatureWillCloneElkRepository()
        {
            var path = CleanFolder("repo-here");

            var feature = new ElkFeature();

            try
            {
                feature.Initialize(new Dictionary <string, object> {
                    { ElkFeature.TargetPath, "repo-here" }
                });
                feature.Execute();

                IsTrue(Directory.Exists(path));
                IsTrue(Directory.GetFiles(path).Any(x => x.EndsWith("docker-compose.yml")));

                feature.Dispose();
                CleanFolder("repo-here");
            }
            catch
            {
                feature.Dispose();
                CleanFolder("repo-here");
                throw;
            }
        }
예제 #2
0
        public void KeepOnDisposeWillKeepClonedRepo()
        {
            var feature = new ElkFeature();

            try
            {
                feature.Initialize(new Dictionary <string, object> {
                    { FeatureConstants.KeepOnDispose, "true" }
                });
                feature.Execute();
                feature.Dispose();

                IsTrue(Directory.Exists(feature.Target));
                IsTrue(Directory.GetFiles(feature.Target).Any(x => x.EndsWith("docker-compose.yml")));

                feature.Services.OfType <ICompositeService>().First().Dispose();
                CleanFolder(Path.GetFileName(feature.Target));
                IsFalse(Directory.Exists(feature.Target));
            }
            catch
            {
                try
                {
                    feature.Services.OfType <ICompositeService>().First().Dispose();
                } catch { /*ignore*/ }

                CleanFolder(Path.GetFileName(feature.Target));
                throw;
            }
        }
예제 #3
0
        [Ignore] // Since not windows compatible
        public void EnableLogSpoutExtensionShallWork()
        {
            try
            {
                using (var feature = new ElkFeature())
                {
                    feature.Initialize(new Dictionary <string, object> {
                        { ElkFeature.EnableLogspout, "true" }
                    });
                    feature.Execute();

                    var logspout = feature.Services.OfType <ICompositeService>().First().Services.FirstOrDefault(x => x.Name == "logspout");
                    IsNotNull(logspout);
                }
            }
            catch
            {
                Console.WriteLine("Just to make sure Dispose is invoked on feature");
                throw;
            }
        }
예제 #4
0
        public void DisposeDeletesAllContent()
        {
            var feature = new ElkFeature();

            try
            {
                feature.Initialize();
                feature.Execute();

                IsTrue(Directory.Exists(feature.Target));
                IsTrue(Directory.GetFiles(feature.Target).Any(x => x.EndsWith("docker-compose.yml")));

                feature.Dispose();
                IsFalse(Directory.Exists(feature.Target));
            }
            catch
            {
                feature.Dispose();
                throw;
            }
        }
예제 #5
0
        public void IfNoTargetPathIsSetARandomIsChosen()
        {
            var feature = new ElkFeature();

            try
            {
                feature.Initialize();
                feature.Execute();

                IsTrue(Directory.Exists(feature.Target));
                IsTrue(Directory.GetFiles(feature.Target).Any(x => x.EndsWith("docker-compose.yml")));

                feature.Dispose();
                CleanFolder(Path.GetFileName(feature.Target));
            }
            catch
            {
                feature.Dispose();
                CleanFolder(Path.GetFileName(feature.Target));
                throw;
            }
        }