Exemple #1
0
        public void Load_PluginAction()
        {
            try
            {
                //Arrange
                Setup();

                var actionManifest = new ActionManifestManager();
                actionManifest.Initialize(_hc);

                //Act
                var result = actionManifest.Load(_ec.Object, Path.Combine(TestUtil.GetTestDataPath(), "pluginaction.yml"));

                //Assert
                Assert.Equal("Hello World", result.Name);
                Assert.Equal("Greet the world and record the time", result.Description);
                Assert.Equal(2, result.Inputs.Count);
                Assert.Equal("greeting", result.Inputs[0].Key.AssertString("key").Value);
                Assert.Equal("Hello", result.Inputs[0].Value.AssertString("value").Value);
                Assert.Equal("entryPoint", result.Inputs[1].Key.AssertString("key").Value);
                Assert.Equal("", result.Inputs[1].Value.AssertString("value").Value);

                Assert.Equal(ActionExecutionType.Plugin, result.Execution.ExecutionType);

                var pluginAction = result.Execution as PluginActionExecutionData;

                Assert.Equal("someplugin", pluginAction.Plugin);
            }
            finally
            {
                Teardown();
            }
        }
Exemple #2
0
        public void Load_ContainerAction_NoArgsNoEnv()
        {
            try
            {
                //Arrange
                Setup();

                var actionManifest = new ActionManifestManager();
                actionManifest.Initialize(_hc);

                //Act
                var result = actionManifest.Load(_ec.Object, Path.Combine(TestUtil.GetTestDataPath(), "dockerfileaction_noargs_noenv_noentrypoint.yml"));

                //Assert
                Assert.Equal("Hello World", result.Name);
                Assert.Equal("Greet the world and record the time", result.Description);
                Assert.Equal(2, result.Inputs.Count);
                Assert.Equal("greeting", result.Inputs[0].Key.AssertString("key").Value);
                Assert.Equal("Hello", result.Inputs[0].Value.AssertString("value").Value);
                Assert.Equal("entryPoint", result.Inputs[1].Key.AssertString("key").Value);
                Assert.Equal("", result.Inputs[1].Value.AssertString("value").Value);

                Assert.Equal(ActionExecutionType.Container, result.Execution.ExecutionType);

                var containerAction = result.Execution as ContainerActionExecutionData;

                Assert.Equal("Dockerfile", containerAction.Image);
            }
            finally
            {
                Teardown();
            }
        }
Exemple #3
0
        public void Load_ContainerAction_Dockerfile_Pre()
        {
            try
            {
                //Arrange
                Setup();

                var actionManifest = new ActionManifestManager();
                actionManifest.Initialize(_hc);

                //Act
                var result = actionManifest.Load(_ec.Object, Path.Combine(TestUtil.GetTestDataPath(), "dockerfileaction_init.yml"));

                //Assert

                Assert.Equal("Hello World", result.Name);
                Assert.Equal("Greet the world and record the time", result.Description);
                Assert.Equal(2, result.Inputs.Count);
                Assert.Equal("greeting", result.Inputs[0].Key.AssertString("key").Value);
                Assert.Equal("Hello", result.Inputs[0].Value.AssertString("value").Value);
                Assert.Equal("entryPoint", result.Inputs[1].Key.AssertString("key").Value);
                Assert.Equal("", result.Inputs[1].Value.AssertString("value").Value);

                Assert.Equal(ActionExecutionType.Container, result.Execution.ExecutionType);

                var containerAction = result.Execution as ContainerActionExecutionData;

                Assert.Equal("Dockerfile", containerAction.Image);
                Assert.Equal("main.sh", containerAction.EntryPoint);
                Assert.Equal("init.sh", containerAction.Pre);
                Assert.Equal("success()", containerAction.InitCondition);
                Assert.Equal("bzz", containerAction.Arguments[0].ToString());
                Assert.Equal("Token", containerAction.Environment[0].Key.ToString());
                Assert.Equal("foo", containerAction.Environment[0].Value.ToString());
                Assert.Equal("Url", containerAction.Environment[1].Key.ToString());
                Assert.Equal("bar", containerAction.Environment[1].Value.ToString());
            }
            finally
            {
                Teardown();
            }
        }
Exemple #4
0
        public void Load_NodeAction_Cleanup_DefaultCondition()
        {
            try
            {
                //Arrange
                Setup();

                var actionManifest = new ActionManifestManager();
                actionManifest.Initialize(_hc);

                //Act
                var result = actionManifest.Load(_ec.Object, Path.Combine(TestUtil.GetTestDataPath(), "nodeaction_cleanup_default.yml"));

                //Assert
                Assert.Equal("Hello World", result.Name);
                Assert.Equal("Greet the world and record the time", result.Description);
                Assert.Equal(2, result.Inputs.Count);
                Assert.Equal("greeting", result.Inputs[0].Key.AssertString("key").Value);
                Assert.Equal("Hello", result.Inputs[0].Value.AssertString("value").Value);
                Assert.Equal("entryPoint", result.Inputs[1].Key.AssertString("key").Value);
                Assert.Equal("", result.Inputs[1].Value.AssertString("value").Value);
                Assert.Equal(1, result.Deprecated.Count);

                Assert.True(result.Deprecated.ContainsKey("greeting"));
                result.Deprecated.TryGetValue("greeting", out string value);
                Assert.Equal("This property has been deprecated", value);

                Assert.Equal(ActionExecutionType.NodeJS, result.Execution.ExecutionType);

                var nodeAction = result.Execution as NodeJSActionExecutionData;

                Assert.Equal("main.js", nodeAction.Script);
                Assert.Equal("cleanup.js", nodeAction.Post);
                Assert.Equal("always()", nodeAction.CleanupCondition);
            }
            finally
            {
                Teardown();
            }
        }
Exemple #5
0
        public void Load_ConditionalCompositeAction()
        {
            try
            {
                //Arrange
                Setup();

                var actionManifest = new ActionManifestManager();
                actionManifest.Initialize(_hc);

                //Act
                var result = actionManifest.Load(_ec.Object, Path.Combine(TestUtil.GetTestDataPath(), "conditional_composite_action.yml"));

                //Assert
                Assert.Equal("Conditional Composite", result.Name);
                Assert.Equal(ActionExecutionType.Composite, result.Execution.ExecutionType);
            }
            finally
            {
                Teardown();
            }
        }