Skip to content
This repository was archived by the owner on Mar 19, 2025. It is now read-only.

Commit f383b06

Browse files
Merge pull request #54 from SubPointSolutions/dev
0.1.0-beta4
2 parents e7acce3 + a3cbaa6 commit f383b06

32 files changed

+758
-511
lines changed

Build/Build.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@
3939
<Reference Include="System.Xml" />
4040
</ItemGroup>
4141
<ItemGroup>
42+
<None Include="github-release-notes.chtml" />
4243
<None Include="Pester\helpers.ps1" />
4344
<None Include="Pester\metapack.cli.core.ps1" />
4445
<None Include="Pester\metapack.cli.provision.ps1" />
45-
<None Include="Pester\pester.run.ps1" />
46+
<None Include="Pester\pester.cli.core.ps1" />
47+
<None Include="Pester\pester.cli.provision.ps1" />
4648
<None Include="Pester\_install.ps1" />
4749
<Compile Include="Properties\AssemblyInfo.cs" />
4850
<None Include="tools\nuget.config" />

Build/Pester/helpers.ps1

Lines changed: 62 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,85 @@ $nugetSource = "https://www.myget.org/F/subpointsolutions-ci/api/v2"
55

66
Write-Host "Reading environment variables..." -fore Green
77

8-
$siteUrl = [environment]::GetEnvironmentVariable("MetaPack.SharePoint.O365.RootWebUrl", "machine")
8+
function Analyse-Results($results) {
9+
10+
$failedCount = 0;
11+
$passedCount = 0;
12+
13+
foreach($r in $results.TestResult) {
14+
15+
Write-Host "- Test [$($r.Name)] with result:[$($r.Result)]"
16+
17+
switch($r.Result) {
18+
"Failed" {
19+
$failedCount++
20+
};
21+
"Passed" {
22+
$passedCount++
23+
};
24+
}
25+
}
26+
27+
Write-Host "- Failed count:[$failedCount]"
28+
Write-Host "- Passed count:[$passedCount]"
29+
30+
if($failedCount -gt 0) {
31+
Write-Host "[FAIL] Didn't pass Pester regression. Failed tests count:[$failedCount]"
32+
return $false
33+
}
34+
else{
35+
if($passedCount -le 0) {
36+
Write-Host "[FAIL] Weird. No tests were passed. Check it, please?"
37+
return $false
38+
}
39+
}
40+
41+
return $true
42+
}
43+
44+
function GetGlobalEnvironmentVariable($name) {
45+
46+
$result = [System.Environment]::GetEnvironmentVariable($name, "Process");
47+
48+
if([String]::IsNullOrEmpty($result) -eq $true)
49+
{
50+
$result = System.Environment.GetEnvironmentVariable($name, "User");
51+
}
52+
53+
if([String]::IsNullOrEmpty($result) -eq $true)
54+
{
55+
$result = System.Environment.GetEnvironmentVariable($name, "Machine");
56+
}
57+
58+
return $result;
59+
}
60+
61+
$siteUrl = GetGlobalEnvironmentVariable "MetaPack.SharePoint.O365.RootWebUrl"
962
if([string]::IsNullOrEmpty($siteUrl) -eq $true) {
1063
throw "o365 siteUrl is null or empty"
1164
}
1265

13-
$userName = [environment]::GetEnvironmentVariable("MetaPack.SharePoint.O365.UserName", "machine")
66+
$userName = GetGlobalEnvironmentVariable "MetaPack.SharePoint.O365.UserName"
1467
if([string]::IsNullOrEmpty($userName) -eq $true) {
1568
throw "o365 userName is null or empty"
1669
}
1770

18-
$userPassword = [environment]::GetEnvironmentVariable("MetaPack.SharePoint.O365.UserPassword", "machine")
71+
$userPassword = GetGlobalEnvironmentVariable "MetaPack.SharePoint.O365.UserPassword"
1972
if([string]::IsNullOrEmpty($userPassword) -eq $true) {
2073
throw "o365 userPassword is null or empty"
2174
}
2275

23-
$sp2013SiteUrl = [environment]::GetEnvironmentVariable("MetaPack.SharePoint.SP2013.RootWebUrl", "machine")
76+
$sp2013SiteUrl = GetGlobalEnvironmentVariable "MetaPack.SharePoint.SP2013.RootWebUrl"
2477
if([string]::IsNullOrEmpty($sp2013SiteUrl) -eq $true) {
2578
throw "sp2013SiteUrl user name is null or empty"
2679
}
2780

28-
$sp2013UserName = [environment]::GetEnvironmentVariable("MetaPack.SharePoint.SP2013.UserName", "machine")
81+
$sp2013UserName = GetGlobalEnvironmentVariable "MetaPack.SharePoint.SP2013.UserName"
2982
if([string]::IsNullOrEmpty($sp2013UserName) -eq $true) {
3083
throw "sp2013 user name is null or empty"
3184
}
3285

33-
$sp2013UserPassword = [environment]::GetEnvironmentVariable("MetaPack.SharePoint.SP2013.UserPassword", "machine")
86+
$sp2013UserPassword = GetGlobalEnvironmentVariable "MetaPack.SharePoint.SP2013.UserPassword"
3487
if([string]::IsNullOrEmpty($sp2013UserPassword) -eq $true) {
3588
throw "sp2013 user password is null or empty"
3689
}
@@ -68,7 +121,6 @@ function RunMetaPackCLI($processArgs, $useShellExecute)
68121
$Process = New-Object System.Diagnostics.Process
69122
$Process.StartInfo = $ProcessInfo
70123
$Process.Start() | Out-Null
71-
$Process.WaitForExit()
72124

73125
if($useShellExecute -eq $true)
74126
{
@@ -77,9 +129,11 @@ function RunMetaPackCLI($processArgs, $useShellExecute)
77129
else
78130
{
79131
$output = $Process.StandardOutput.ReadToEnd()
80-
Write-Host $output
132+
#Write-Host $output
81133
}
82134

135+
$Process.WaitForExit()
136+
83137
return @{
84138
Output = $output
85139
ExitCode = $Process.ExitCode

Build/Pester/metapack.cli.core.ps1

Lines changed: 2 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
. "Pester\helpers.ps1"
22

3+
Write-Host "Running CLI provisioning tests..." -fore Green
4+
35
Describe "metapack.cli.core" {
46

57
# generic tests
@@ -34,105 +36,4 @@ Describe "metapack.cli.core" {
3436
# exist code, please 0
3537
($exitCode) | Should Be 0
3638
}
37-
38-
# # spmeta2 provider runs for O365
39-
# It "Can instsall SPMeta2.CI package" {
40-
41-
# $args = @("install",
42-
# "--id $m2PackageId",
43-
# "--url $siteUrl"
44-
# "--username", $userName,
45-
# "--userpassword", $userPassword
46-
# "--spversion", "o365",
47-
# "--source", $nugetSource
48-
# "--verbose"
49-
# )
50-
51-
# $result = (RunMetaPackCLI $args)
52-
53-
# $output = $result.Output
54-
# $exitCode = $result.ExitCode
55-
56-
# # no exception in output
57-
# (OutputHasError $output) | Should Be $false
58-
59-
# # exist code, please 0
60-
# ($exitCode) | Should Be 0
61-
# }
62-
63-
# It "Can instsall SPMeta2.CI package --force" {
64-
65-
# $args = @("install",
66-
# "--id $m2PackageId",
67-
# "--url $siteUrl"
68-
# "--username", $userName,
69-
# "--userpassword", $userPassword
70-
# "--spversion", "o365",
71-
# "--source", $nugetSource
72-
# "--verbose",
73-
# "--force"
74-
# )
75-
76-
# $result = (RunMetaPackCLI $args)
77-
78-
# $output = $result.Output
79-
# $exitCode = $result.ExitCode
80-
81-
# # no exception in output
82-
# (OutputHasError $output) | Should Be $false
83-
84-
# # exist code, please 0
85-
# ($exitCode) | Should Be 0
86-
# }
87-
88-
# # SharePointPno provider runs for O365
89-
90-
# It "Can instsall SharePointPnP.CI package" {
91-
92-
# $args = @("install",
93-
# "--id $spPnPPackageId",
94-
# "--url $siteUrl"
95-
# "--username", $userName,
96-
# "--userpassword", $userPassword
97-
# "--spversion", "o365",
98-
# "--source", $nugetSource
99-
# "--verbose"
100-
# )
101-
102-
# $result = (RunMetaPackCLI $args)
103-
104-
# $output = $result.Output
105-
# $exitCode = $result.ExitCode
106-
107-
# # no exception in output
108-
# (OutputHasError $output) | Should Be $false
109-
110-
# # exist code, please 0
111-
# ($exitCode) | Should Be 0
112-
# }
113-
114-
# It "Can instsall SharePointPnP.CI package --force" {
115-
116-
# $args = @("install",
117-
# "--id $spPnPPackageId",
118-
# "--url $siteUrl"
119-
# "--username", $userName,
120-
# "--userpassword", $userPassword
121-
# "--spversion", "o365",
122-
# "--source", $nugetSource
123-
# "--verbose",
124-
# "--force"
125-
# )
126-
127-
# $result = (RunMetaPackCLI $args)
128-
129-
# $output = $result.Output
130-
# $exitCode = $result.ExitCode
131-
132-
# # no exception in output
133-
# (OutputHasError $output) | Should Be $false
134-
135-
# # exist code, please 0
136-
# ($exitCode) | Should Be 0
137-
# }
13839
}

Build/Pester/metapack.cli.provision.ps1

Lines changed: 54 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11

22
. "Pester\helpers.ps1"
33

4+
5+
Write-Host "Running CLI provisioning tests..." -fore Green
6+
47
# O365
58
Describe "metapack.cli.provision.spmeta2.o365" {
69

@@ -16,46 +19,47 @@ Describe "metapack.cli.provision.spmeta2.o365" {
1619
"--verbose"
1720
)
1821

19-
$result = (RunMetaPackCLI $args $true)
22+
$result = (RunMetaPackCLI $args $false)
2023

2124
$output = $result.Output
2225
$exitCode = $result.ExitCode
2326

2427
# no exception in output
2528
if($result.UseShellExecute -eq $false) {
2629
(OutputHasError $output) | Should Be $false
30+
#Write-Host $output
2731
}
2832

2933
# exist code, please 0
3034
($exitCode) | Should Be 0
3135
}
3236

33-
It "Can install [$m2PackageId] package --force" {
37+
#It "Can install [$m2PackageId] package --force" {
3438

35-
$args = @("install",
36-
"--id $m2PackageId",
37-
"--url $siteUrl"
38-
"--username", $userName,
39-
"--userpassword", $userPassword
40-
"--spversion", "o365",
41-
"--source", $nugetSource
42-
"--verbose",
43-
"--force"
44-
)
45-
46-
$result = (RunMetaPackCLI $args $true)
47-
48-
$output = $result.Output
49-
$exitCode = $result.ExitCode
50-
51-
# no exception in output
52-
if($result.UseShellExecute -eq $false) {
53-
(OutputHasError $output) | Should Be $false
54-
}
39+
# $args = @("install",
40+
# "--id $m2PackageId",
41+
# "--url $siteUrl"
42+
# "--username", $userName,
43+
# "--userpassword", $userPassword
44+
# "--spversion", "o365",
45+
# "--source", $nugetSource
46+
# "--verbose",
47+
# "--force"
48+
# )
49+
50+
# $result = (RunMetaPackCLI $args $true)
51+
52+
# $output = $result.Output
53+
# $exitCode = $result.ExitCode
54+
55+
# # no exception in output
56+
# if($result.UseShellExecute -eq $false) {
57+
# (OutputHasError $output) | Should Be $false
58+
# }
5559

56-
# exist code, please 0
57-
($exitCode) | Should Be 0
58-
}
60+
# # exist code, please 0
61+
# ($exitCode) | Should Be 0
62+
#}
5963
}
6064

6165
Describe "metapack.cli.provision.pnp.o365" {
@@ -72,7 +76,7 @@ Describe "metapack.cli.provision.pnp.o365" {
7276
"--verbose"
7377
)
7478

75-
$result = (RunMetaPackCLI $args $true)
79+
$result = (RunMetaPackCLI $args $false)
7680

7781
$output = $result.Output
7882
$exitCode = $result.ExitCode
@@ -86,32 +90,32 @@ Describe "metapack.cli.provision.pnp.o365" {
8690
($exitCode) | Should Be 0
8791
}
8892

89-
It "Can install [$spPnPPackageId] package --force" {
93+
#It "Can install [$spPnPPackageId] package --force" {
9094

91-
$args = @("install",
92-
"--id $spPnPPackageId",
93-
"--url $siteUrl"
94-
"--username", $userName,
95-
"--userpassword", $userPassword
96-
"--spversion", "o365",
97-
"--source", $nugetSource
98-
"--verbose",
99-
"--force"
100-
)
101-
102-
$result = (RunMetaPackCLI $args $true)
103-
104-
$output = $result.Output
105-
$exitCode = $result.ExitCode
106-
107-
# no exception in output
108-
if($result.UseShellExecute -eq $false) {
109-
(OutputHasError $output) | Should Be $false
110-
}
95+
# $args = @("install",
96+
# "--id $spPnPPackageId",
97+
# "--url $siteUrl"
98+
# "--username", $userName,
99+
# "--userpassword", $userPassword
100+
# "--spversion", "o365",
101+
# "--source", $nugetSource
102+
# "--verbose",
103+
# "--force"
104+
# )
105+
106+
# $result = (RunMetaPackCLI $args $true)
107+
108+
# $output = $result.Output
109+
# $exitCode = $result.ExitCode
110+
111+
# # no exception in output
112+
# if($result.UseShellExecute -eq $false) {
113+
# (OutputHasError $output) | Should Be $false
114+
# }
111115

112-
# exist code, please 0
113-
($exitCode) | Should Be 0
114-
}
116+
# # exist code, please 0
117+
# ($exitCode) | Should Be 0
118+
#}
115119
}
116120

117121
# SP2013 CSOM

0 commit comments

Comments
 (0)