-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Johannes Bengtsson
committed
May 18, 2021
1 parent
2c3db8d
commit dcc8f95
Showing
4 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/AsimovDeploy.WinAgent.IntegrationTests/Scenarios/VerifyScenario/ConfigFiles/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"WebPort": %AGENT_PORT%, | ||
"DataFolder": "%DATA_FOLDER%", | ||
"HeartbeatIntervalSeconds": 10, | ||
"NodeFrontUrl": "%NODE_FRONT_URL%", | ||
"Environment": "dev", | ||
"ConfigVersion": 1, | ||
|
||
"PackageSources": { | ||
"Test": { "Type": "FileSystem", "Uri": "%PACKAGES_URI%" } | ||
}, | ||
|
||
"Units": [ | ||
{ | ||
"Name": "VerifyTest", | ||
"Type": "PowerShell", | ||
|
||
"PackageInfo": { "Source": "Test" }, | ||
|
||
"Url": "http://localhost:2121", | ||
|
||
"DeployParameters": { | ||
"Tasks": { "Type": "Text", "Default": "Deploy-Everything" } | ||
}, | ||
|
||
"Actions": { | ||
"verify1": { "Type": "VerifyCommand", "ZipPath": "verify.zip", "Command": "script.ps1" }, | ||
"verify2": { "Type": "VerifyCommand", "ZipPath": "verify.folder", "Command": "script.ps1" } | ||
} | ||
} | ||
] | ||
} |
Binary file added
BIN
+414 Bytes
...ent.IntegrationTests/Scenarios/VerifyScenario/Packages/PSTest-v1.0.0.0-[master]-[123].zip
Binary file not shown.
78 changes: 78 additions & 0 deletions
78
...AsimovDeploy.WinAgent.IntegrationTests/Scenarios/VerifyScenario/VerifyScenarioScenario.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Threading; | ||
using AsimovDeploy.WinAgent.Framework.Common; | ||
using AsimovDeploy.WinAgent.Framework.Configuration; | ||
using AsimovDeploy.WinAgent.Web.Commands; | ||
using AsimovDeploy.WinAgent.Web.Contracts; | ||
using NUnit.Framework; | ||
using Shouldly; | ||
|
||
namespace AsimovDeploy.WinAgent.IntegrationTests.Scenarios.VerifyScenario | ||
{ | ||
[TestFixture] | ||
public class PowershellScenario : WinAgentSystemTest | ||
{ | ||
public override void Given() | ||
{ | ||
GivenFoldersForScenario(); | ||
GivenRunningAgent(); | ||
} | ||
|
||
[Test] | ||
public void can_get_deploy_unit_info() | ||
{ | ||
var units = Agent.Get<List<DeployUnitInfoDTO>>("/units/list"); | ||
units.Count.ShouldBe(1); | ||
units[0].name.ShouldBe("VerifyTest"); | ||
units[0].status.ShouldBe("NA"); | ||
units[0].url.ShouldBe(string.Format("http://{0}:2121", HostNameUtil.GetFullHostName())); | ||
units[0].hasDeployParameters.ShouldBe(true); | ||
units[0].type.ShouldBe(DeployUnitTypes.PowerShell); | ||
} | ||
|
||
[Test] | ||
public void can_get_deploy_parameters() | ||
{ | ||
var parameters = Agent.Get<List<dynamic>>("/units/deploy-parameters/VerifyTest"); | ||
parameters.Count.ShouldBe(1); | ||
((string)parameters[0].name).ShouldBe("Tasks"); | ||
((string)parameters[0].type).ShouldBe("text"); | ||
((string)parameters[0].@default).ShouldBe("Deploy-Everything"); | ||
} | ||
|
||
[Test] | ||
public void can_deploy_powershell_unit() | ||
{ | ||
var versions = Agent.Get<List<DeployUnitVersionDTO>>("/versions/VerifyTest"); | ||
versions.Count.ShouldBe(1); | ||
|
||
var parameters = new Dictionary<string, object>(); | ||
parameters["Tasks"] = "some text value"; | ||
|
||
Agent.Post("/deploy/deploy", NodeFront.ApiKey, new DeployCommand | ||
{ | ||
unitName = "VerifyTest", | ||
versionId = versions[0].id, | ||
parameters = parameters | ||
}); | ||
|
||
Thread.Sleep(2000); | ||
|
||
// File.Exists(Path.Combine(TempDir, "some.txt")).ShouldBe(true); | ||
// File.Exists(Path.Combine(TempDir, "text.txt")).ShouldBe(true); | ||
// File.Exists(Path.Combine(TempDir, "value.txt")).ShouldBe(true); | ||
|
||
var units = Agent.Get<List<DeployUnitInfoDTO>>("/units/list");; | ||
units[0].version.ShouldBe("1.0.0.0"); | ||
units[0].branch.ShouldBe("master"); | ||
|
||
var deployLog = Agent.Get<List<dynamic>>("/deploylog/list/VerifyTest"); | ||
deployLog.Count.ShouldBe(1); | ||
((string)deployLog[0].version).ShouldBe("1.0.0.0"); | ||
((string)deployLog[0].status).ShouldBe("Success"); | ||
((string)deployLog[0].branch).ShouldBe("master"); | ||
((int)deployLog[0].position).ShouldBe(0); | ||
} | ||
} | ||
} |