Exemplo n.º 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;
            }
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 3
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;
            }
        }
Exemplo n.º 4
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;
            }
        }