Skip to content
Browse files

Updated CustomNodeScript test to a valid node custom deployment scrip…

…t scenario.

Fixed issue #274.
  • Loading branch information...
1 parent a12015c commit 918d98e7f01f29e20a6b443dd4c66368aae454ae Amit Apple committed
Showing with 10 additions and 49 deletions.
  1. +9 −49 Kudu.FunctionalTests/GitRepositoryManagementTests.cs
  2. +1 −0 Kudu.TestHarness/TestRepositories.cs
View
58 Kudu.FunctionalTests/GitRepositoryManagementTests.cs
@@ -717,66 +717,26 @@ public void FailedNpmFailsDeployment()
}
}
- [Fact(Skip = "Not a valid scenario")]
+ [Fact]
public void CustomNodeScript()
{
- string repositoryName = "CustomNodeScript";
- string appName = KuduUtils.GetRandomWebsiteName("CustomNodeScript");
- string webConfig = @"
-<?xml version=""1.0"" encoding=""utf-8""?>
-<configuration>
- <system.webServer>
- <handlers>
- <add name=""iisnode"" path=""server.js"" verb=""*"" modules=""iisnode""/>
- </handlers>
- <rewrite>
- <rules>
- <rule name=""StaticContent"">
- <action type=""Rewrite"" url=""public{REQUEST_URI}""/>
- </rule>
- <rule name=""DynamicContent"">
- <conditions>
- <add input=""{REQUEST_FILENAME}"" matchType=""IsFile"" negate=""True""/>
- </conditions>
- <action type=""Rewrite"" url=""server.js""/>
- </rule>
- </rules>
- </rewrite>
- <iisnode
- nodeProcessCommandLine=""&quot;%programfiles(x86)%\nodejs\node.exe&quot;""
- debuggingEnabled=""false""
- logDirectory=""..\..\LogFiles\nodejs""
- watchedFiles=""*.js;iisnode.yml;node_modules\*;views\*.jade;views\*.ejb;routes\*.js"" />
- </system.webServer>
- </configuration>";
-
- var path = Git.GetRepositoryPath(repositoryName);
-
- using (var repo = Git.Init(path))
- {
- repo.WriteFile("build.js", String.Format(@"var fs = require('fs');
-console.log('Creating server.js on the fly!');
-console.log('target is ' + process.env.DEPLOYMENT_TARGET);
-fs.writeFileSync(process.env.DEPLOYMENT_TARGET + '\server.js', ""var http = require('http'); http.createServer(function (req, res) {{ res.writeHead(200, {{'Content-Type': 'text/html'}}); res.end('Hello, world! [helloworld sample; iisnode version is ' + process.env.IISNODE_VERSION + ', node version is ' + process.version + ']'); }}).listen(process.env.PORT);"");
-console.log('Done!');", webConfig));
- repo.WriteFile(".deployment", @"
-[config]
-command = node build.js
-");
- repo.WriteFile("web.config", webConfig);
-
- Git.Commit(repo.PhysicalPath, "Added build.js");
+ // Arrange
+ string repositoryName = "VersionPinnedNodeJsAppCustom";
+ string appName = KuduUtils.GetRandomWebsiteName("VersionPinnedNodeJsAppCustom");
+ using (var repo = Git.Clone(repositoryName))
+ {
ApplicationManager.Run(appName, appManager =>
{
// Act
- appManager.GitDeploy(repo.PhysicalPath);
+ GitDeploymentResult deployResult = appManager.GitDeploy(repo.PhysicalPath);
var results = appManager.DeploymentManager.GetResultsAsync().Result.ToList();
// Assert
Assert.Equal(1, results.Count);
Assert.Equal(DeployStatus.Success, results[0].Status);
- KuduAssert.VerifyUrl(appManager.SiteUrl);
+ KuduAssert.VerifyUrl(appManager.SiteUrl, "v0.8.2");
+ KuduAssert.VerifyLogOutput(appManager, results[0].Id, "custom deployment success");
});
}
}
View
1 Kudu.TestHarness/TestRepositories.cs
@@ -26,6 +26,7 @@ class TestRepositories
new TestRepositoryInfo("https://github.com/KuduApps/NpmSite.git", "2b29b9d"),
new TestRepositoryInfo("https://github.com/KuduApps/LogTester.git", "f20ab64"),
new TestRepositoryInfo("https://github.com/KuduApps/VersionPinnedNodeJsApp.git", "9461da6"),
+ new TestRepositoryInfo("https://github.com/KuduApps/VersionPinnedNodeJsAppCustom.git", "5cc6d3d"),
new TestRepositoryInfo("https://github.com/KuduApps/WarningsAsErrors.git", "51b6a48"),
new TestRepositoryInfo("https://github.com/KuduApps/waws.git", "7652a66"),
};

0 comments on commit 918d98e

Please sign in to comment.
Something went wrong with that request. Please try again.