aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorBevan Weiss <bevan.weiss@gmail.com>2024-08-04 21:13:44 +1000
committerRob Mensching <rob@firegiant.com>2025-02-11 23:14:49 -0800
commit5b4a6538ee06988c75b717bd905197fb670e6142 (patch)
treeeb078854f258ebdabaf206282d56cbdcf87759ef /src/test
parent2c5bb89424b12de812498d568bc1aae2d4098e60 (diff)
downloadwix-5b4a6538ee06988c75b717bd905197fb670e6142.tar.gz
wix-5b4a6538ee06988c75b717bd905197fb670e6142.tar.bz2
wix-5b4a6538ee06988c75b717bd905197fb670e6142.zip
Add/Remove Group Membership rollback handled.
Fixups to a few test cases. Signed-off-by: Bevan Weiss <bevan.weiss@gmail.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/burn/WixTestTools/RuntimeFactAttribute.cs32
-rw-r--r--src/test/msi/TestData/UtilExtensionGroupTests/ProductA/product.wxs9
-rw-r--r--src/test/msi/TestData/UtilExtensionGroupTests/ProductAddCommentToExistingGroup/product.wxs9
-rw-r--r--src/test/msi/TestData/UtilExtensionGroupTests/ProductCommentDelete/product.wxs4
-rw-r--r--src/test/msi/TestData/UtilExtensionGroupTests/ProductCommentFail/product_fail.wxs4
-rw-r--r--src/test/msi/TestData/UtilExtensionGroupTests/ProductFail/product_fail.wxs2
-rw-r--r--src/test/msi/TestData/UtilExtensionGroupTests/ProductFailIfExists/FailIfExists.wxs2
-rw-r--r--src/test/msi/TestData/UtilExtensionGroupTests/ProductNestedGroups/product.wxs7
-rw-r--r--src/test/msi/TestData/UtilExtensionGroupTests/ProductNewGroupWithComment/product.wxs9
-rw-r--r--src/test/msi/TestData/UtilExtensionGroupTests/ProductNonVitalGroup/NonVitalUserGroup.wxs2
-rw-r--r--src/test/msi/TestData/UtilExtensionGroupTests/ProductRestrictedDomain/RestrictedDomain.wxs4
-rw-r--r--src/test/msi/TestData/UtilExtensionGroupTests/ProductWithCommandLineParameters/ProductWithCommandLineParameters.wxs11
-rw-r--r--src/test/msi/WixToolsetTest.MsiE2E/UtilExtensionGroupTests.cs95
-rw-r--r--src/test/msi/WixToolsetTest.MsiE2E/runtests.cmd1
14 files changed, 135 insertions, 56 deletions
diff --git a/src/test/burn/WixTestTools/RuntimeFactAttribute.cs b/src/test/burn/WixTestTools/RuntimeFactAttribute.cs
index 573a9de2..76004f26 100644
--- a/src/test/burn/WixTestTools/RuntimeFactAttribute.cs
+++ b/src/test/burn/WixTestTools/RuntimeFactAttribute.cs
@@ -3,6 +3,7 @@
3namespace WixTestTools 3namespace WixTestTools
4{ 4{
5 using System; 5 using System;
6 using System.DirectoryServices.ActiveDirectory;
6 using System.Security.Principal; 7 using System.Security.Principal;
7 using WixInternal.TestSupport.XunitExtensions; 8 using WixInternal.TestSupport.XunitExtensions;
8 using System.Runtime.InteropServices; 9 using System.Runtime.InteropServices;
@@ -10,10 +11,13 @@ namespace WixTestTools
10 public class RuntimeFactAttribute : SkippableFactAttribute 11 public class RuntimeFactAttribute : SkippableFactAttribute
11 { 12 {
12 const string RequiredEnvironmentVariableName = "RuntimeTestsEnabled"; 13 const string RequiredEnvironmentVariableName = "RuntimeTestsEnabled";
14 const string RequiredDomainEnvironmentVariableName = "RuntimeDomainTestsEnabled";
13 15
14 public static bool RuntimeTestsEnabled { get; } 16 public static bool RuntimeTestsEnabled { get; }
17 public static bool RuntimeDomainTestsEnabled { get; }
15 public static bool RunningAsAdministrator { get; } 18 public static bool RunningAsAdministrator { get; }
16 public static bool RunningOnWindowsServer { get; } 19 public static bool RunningOnWindowsServer { get; }
20 public static bool RunningInDomain { get; }
17 21
18 [DllImport("shlwapi.dll", SetLastError = true, EntryPoint = "#437")] 22 [DllImport("shlwapi.dll", SetLastError = true, EntryPoint = "#437")]
19 private static extern bool IsOS(int os); 23 private static extern bool IsOS(int os);
@@ -23,7 +27,6 @@ namespace WixTestTools
23 return IsOS(OS_ANYSERVER); 27 return IsOS(OS_ANYSERVER);
24 } 28 }
25 29
26
27 static RuntimeFactAttribute() 30 static RuntimeFactAttribute()
28 { 31 {
29 using var identity = WindowsIdentity.GetCurrent(); 32 using var identity = WindowsIdentity.GetCurrent();
@@ -33,6 +36,33 @@ namespace WixTestTools
33 var testsEnabledString = Environment.GetEnvironmentVariable(RequiredEnvironmentVariableName); 36 var testsEnabledString = Environment.GetEnvironmentVariable(RequiredEnvironmentVariableName);
34 RuntimeTestsEnabled = Boolean.TryParse(testsEnabledString, out var testsEnabled) && testsEnabled; 37 RuntimeTestsEnabled = Boolean.TryParse(testsEnabledString, out var testsEnabled) && testsEnabled;
35 38
39 RunningInDomain = false;
40 try
41 {
42 RunningInDomain = !String.IsNullOrEmpty(System.DirectoryServices.ActiveDirectory.Domain.GetComputerDomain().Name);
43 }
44 catch (ActiveDirectoryObjectNotFoundException) { }
45
46 var domainTestsEnabledString = Environment.GetEnvironmentVariable(RequiredDomainEnvironmentVariableName);
47 RuntimeDomainTestsEnabled = Boolean.TryParse(domainTestsEnabledString, out var domainTestsEnabled) && domainTestsEnabled;
48 }
49
50 private bool _domainRequired;
51 public bool DomainRequired
52 {
53 get
54 {
55 return _domainRequired;
56 }
57 set
58 {
59 _domainRequired = value;
60 if (_domainRequired && String.IsNullOrEmpty(this.Skip) && (!RunningInDomain || !RuntimeDomainTestsEnabled))
61 {
62 this.Skip = $"These tests require the test host to be running as a domain member ({(RunningInDomain ? "passed" : "failed")}). These tests affect both MACHINE AND DOMAIN state. To accept the consequences, set the {RequiredDomainEnvironmentVariableName} environment variable to true ({(RuntimeDomainTestsEnabled ? "passed" : "failed")}).";
63 }
64 }
65
36 RunningOnWindowsServer = IsWindowsServer(); 66 RunningOnWindowsServer = IsWindowsServer();
37 } 67 }
38 68
diff --git a/src/test/msi/TestData/UtilExtensionGroupTests/ProductA/product.wxs b/src/test/msi/TestData/UtilExtensionGroupTests/ProductA/product.wxs
index e3c143e6..f7f60fdb 100644
--- a/src/test/msi/TestData/UtilExtensionGroupTests/ProductA/product.wxs
+++ b/src/test/msi/TestData/UtilExtensionGroupTests/ProductA/product.wxs
@@ -7,19 +7,18 @@
7 <ComponentRef Id="Component1" /> 7 <ComponentRef Id="Component1" />
8 </ComponentGroup> 8 </ComponentGroup>
9 9
10 <Property Id="TEMPDOMAIN" Secure="yes" /> 10 <Property Id="TESTDOMAIN" Secure="yes" />
11 <Property Id="TEMPGROUPNAME" Secure="yes" />
12 </Fragment> 11 </Fragment>
13 12
14 <Fragment> 13 <Fragment>
15 <Component Id="Component1" Guid="09624A9A-4BBC-4126-BBF9-0713C5217DB1" Directory="INSTALLFOLDER"> 14 <Component Id="Component1" Guid="09624A9A-4BBC-4126-BBF9-0713C5217DB1" Directory="INSTALLFOLDER">
16 <File Source="$(sys.SOURCEFILEPATH)" KeyPath="yes" /> 15 <File Source="$(sys.SOURCEFILEPATH)" KeyPath="yes" />
17 16
18 <util:Group Id="TEST_GROUP1" Name="testName1" Comment="Group1" CreateGroup="yes" RemoveOnUninstall="yes" /> 17 <util:Group Id="TEST_GROUP1" Name="testName1" Domain="[TESTDOMAIN]" Comment="Group1" CreateGroup="yes" RemoveOnUninstall="yes" />
19 18
20 <util:Group Id="TEST_GROUP2" Name="testName2" Comment="Group2" RemoveOnUninstall="no" UpdateIfExists="yes" /> 19 <util:Group Id="TEST_GROUP2" Name="testName2" Domain="[TESTDOMAIN]" Comment="Group2" RemoveOnUninstall="no" UpdateIfExists="yes" />
21 20
22 <util:Group Id="TEST_GROUP3" Name="testName3" Comment="Group3" CreateGroup="no" /> 21 <util:Group Id="TEST_GROUP3" Name="testName3" Domain="[TESTDOMAIN]" Comment="Group3" CreateGroup="no" />
23 </Component> 22 </Component>
24 </Fragment> 23 </Fragment>
25</Wix> 24</Wix>
diff --git a/src/test/msi/TestData/UtilExtensionGroupTests/ProductAddCommentToExistingGroup/product.wxs b/src/test/msi/TestData/UtilExtensionGroupTests/ProductAddCommentToExistingGroup/product.wxs
index e0170746..6c9d3be3 100644
--- a/src/test/msi/TestData/UtilExtensionGroupTests/ProductAddCommentToExistingGroup/product.wxs
+++ b/src/test/msi/TestData/UtilExtensionGroupTests/ProductAddCommentToExistingGroup/product.wxs
@@ -6,18 +6,15 @@
6 <ComponentGroup Id="ProductComponents"> 6 <ComponentGroup Id="ProductComponents">
7 <ComponentRef Id="Component1" /> 7 <ComponentRef Id="Component1" />
8 </ComponentGroup> 8 </ComponentGroup>
9
10 <Property Id="TESTDOMAIN" Secure="yes" />
9 </Fragment> 11 </Fragment>
10 12
11 <Fragment> 13 <Fragment>
12 <Component Id="Component1" Guid="00030829-0000-0000-C000-000000000046" Directory="INSTALLFOLDER"> 14 <Component Id="Component1" Guid="00030829-0000-0000-C000-000000000046" Directory="INSTALLFOLDER">
13 <File Source="$(sys.SOURCEFILEPATH)" KeyPath="yes" /> 15 <File Source="$(sys.SOURCEFILEPATH)" KeyPath="yes" />
14 16
15 <util:Group Id="TEST_GROUP1" 17 <util:Group Id="TEST_GROUP1" Name="testName1" Domain="[TESTDOMAIN]" CreateGroup="yes" UpdateIfExists="yes" RemoveOnUninstall="yes" Comment="testComment1"/>
16 Name="testName1"
17 CreateGroup="yes"
18 UpdateIfExists="yes"
19 RemoveOnUninstall="yes"
20 Comment="testComment1"/>
21 </Component> 18 </Component>
22 </Fragment> 19 </Fragment>
23</Wix> 20</Wix>
diff --git a/src/test/msi/TestData/UtilExtensionGroupTests/ProductCommentDelete/product.wxs b/src/test/msi/TestData/UtilExtensionGroupTests/ProductCommentDelete/product.wxs
index d1824890..a34a276b 100644
--- a/src/test/msi/TestData/UtilExtensionGroupTests/ProductCommentDelete/product.wxs
+++ b/src/test/msi/TestData/UtilExtensionGroupTests/ProductCommentDelete/product.wxs
@@ -6,13 +6,15 @@
6 <ComponentGroup Id="ProductComponents"> 6 <ComponentGroup Id="ProductComponents">
7 <ComponentRef Id="Component1" /> 7 <ComponentRef Id="Component1" />
8 </ComponentGroup> 8 </ComponentGroup>
9
10 <Property Id="TESTDOMAIN" Secure="yes" />
9 </Fragment> 11 </Fragment>
10 12
11 <Fragment> 13 <Fragment>
12 <Component Id="Component1" Guid="00030829-0000-0000-C000-000000000046" Directory="INSTALLFOLDER"> 14 <Component Id="Component1" Guid="00030829-0000-0000-C000-000000000046" Directory="INSTALLFOLDER">
13 <File Source="$(sys.SOURCEFILEPATH)" KeyPath="yes" /> 15 <File Source="$(sys.SOURCEFILEPATH)" KeyPath="yes" />
14 16
15 <util:Group Id="TEST_GROUP1" Name="testName1" UpdateIfExists="yes" RemoveOnUninstall="yes" RemoveComment="yes"/> 17 <util:Group Id="TEST_GROUP1" Name="testName1" Domain="[TESTDOMAIN]" UpdateIfExists="yes" RemoveOnUninstall="yes" RemoveComment="yes"/>
16 </Component> 18 </Component>
17 </Fragment> 19 </Fragment>
18</Wix> 20</Wix>
diff --git a/src/test/msi/TestData/UtilExtensionGroupTests/ProductCommentFail/product_fail.wxs b/src/test/msi/TestData/UtilExtensionGroupTests/ProductCommentFail/product_fail.wxs
index 4e70717f..79396882 100644
--- a/src/test/msi/TestData/UtilExtensionGroupTests/ProductCommentFail/product_fail.wxs
+++ b/src/test/msi/TestData/UtilExtensionGroupTests/ProductCommentFail/product_fail.wxs
@@ -10,13 +10,15 @@
10 <InstallExecuteSequence> 10 <InstallExecuteSequence>
11 <Custom Action="CaFail" After="Wix6ConfigureGroups_X86" /> 11 <Custom Action="CaFail" After="Wix6ConfigureGroups_X86" />
12 </InstallExecuteSequence> 12 </InstallExecuteSequence>
13
14 <Property Id="TESTDOMAIN" Secure="yes" />
13 </Fragment> 15 </Fragment>
14 16
15 <Fragment> 17 <Fragment>
16 <Component Id="Component1" Guid="00030829-0000-0000-C000-000000000046" Directory="INSTALLFOLDER"> 18 <Component Id="Component1" Guid="00030829-0000-0000-C000-000000000046" Directory="INSTALLFOLDER">
17 <File Source="$(sys.SOURCEFILEPATH)" KeyPath="yes" /> 19 <File Source="$(sys.SOURCEFILEPATH)" KeyPath="yes" />
18 20
19 <util:Group Id="TEST_GROUP1" Name="testName1" CreateGroup="yes" RemoveOnUninstall="yes" Comment="testComment1"/> 21 <util:Group Id="TEST_GROUP1" Name="testName1" Domain="[TESTDOMAIN]" CreateGroup="yes" RemoveOnUninstall="yes" Comment="testComment1"/>
20 </Component> 22 </Component>
21 </Fragment> 23 </Fragment>
22</Wix> 24</Wix>
diff --git a/src/test/msi/TestData/UtilExtensionGroupTests/ProductFail/product_fail.wxs b/src/test/msi/TestData/UtilExtensionGroupTests/ProductFail/product_fail.wxs
index 3013e5a0..148f26ca 100644
--- a/src/test/msi/TestData/UtilExtensionGroupTests/ProductFail/product_fail.wxs
+++ b/src/test/msi/TestData/UtilExtensionGroupTests/ProductFail/product_fail.wxs
@@ -13,6 +13,8 @@
13 <InstallExecuteSequence> 13 <InstallExecuteSequence>
14 <Custom Action="CaFail" After="Wix6ConfigureGroups_X86" /> 14 <Custom Action="CaFail" After="Wix6ConfigureGroups_X86" />
15 </InstallExecuteSequence> 15 </InstallExecuteSequence>
16
17 <Property Id="TESTDOMAIN" Secure="yes" />
16 </Fragment> 18 </Fragment>
17 19
18 <Fragment> 20 <Fragment>
diff --git a/src/test/msi/TestData/UtilExtensionGroupTests/ProductFailIfExists/FailIfExists.wxs b/src/test/msi/TestData/UtilExtensionGroupTests/ProductFailIfExists/FailIfExists.wxs
index 00f8e12d..e7acb5e0 100644
--- a/src/test/msi/TestData/UtilExtensionGroupTests/ProductFailIfExists/FailIfExists.wxs
+++ b/src/test/msi/TestData/UtilExtensionGroupTests/ProductFailIfExists/FailIfExists.wxs
@@ -6,6 +6,8 @@
6 <ComponentGroup Id="ProductComponents"> 6 <ComponentGroup Id="ProductComponents">
7 <ComponentRef Id="Component1" /> 7 <ComponentRef Id="Component1" />
8 </ComponentGroup> 8 </ComponentGroup>
9
10 <Property Id="TESTDOMAIN" Secure="yes" />
9 </Fragment> 11 </Fragment>
10 12
11 <Fragment> 13 <Fragment>
diff --git a/src/test/msi/TestData/UtilExtensionGroupTests/ProductNestedGroups/product.wxs b/src/test/msi/TestData/UtilExtensionGroupTests/ProductNestedGroups/product.wxs
index c27eb27a..f513e7c6 100644
--- a/src/test/msi/TestData/UtilExtensionGroupTests/ProductNestedGroups/product.wxs
+++ b/src/test/msi/TestData/UtilExtensionGroupTests/ProductNestedGroups/product.wxs
@@ -7,13 +7,14 @@
7 <ComponentRef Id="Component1" /> 7 <ComponentRef Id="Component1" />
8 </ComponentGroup> 8 </ComponentGroup>
9 9
10 <Property Id="TEMPDOMAIN" Secure="yes" Value="TESTDOMAIN" /> 10 <Property Id="TESTDOMAIN" Secure="yes" />
11 </Fragment> 11 </Fragment>
12 12
13 <Fragment> 13 <Fragment>
14 <util:Group Id="AUTH_USERS" Name="Authenticated Users" Domain="[TEMPDOMAIN]" > 14 <util:Group Id="DOMAIN_USERS" Name="Domain Users" Domain="[TESTDOMAIN]" >
15 <util:GroupRef Id="TEST_GROUP1" /> 15 <util:GroupRef Id="TEST_GROUP1" />
16 <util:GroupRef Id="TEST_GROUP2" /> 16 <util:GroupRef Id="TEST_GROUP2" />
17 <util:GroupRef Id="TEST_GROUP3" />
17 </util:Group> 18 </util:Group>
18 <util:Group Id="EVERYONE" Name="Everyone" > 19 <util:Group Id="EVERYONE" Name="Everyone" >
19 <util:GroupRef Id="TEST_GROUP1" /> 20 <util:GroupRef Id="TEST_GROUP1" />
@@ -25,6 +26,8 @@
25 <util:Group Id="TEST_GROUP1" Name="testName1" Comment="Group1" CreateGroup="yes" RemoveOnUninstall="yes" /> 26 <util:Group Id="TEST_GROUP1" Name="testName1" Comment="Group1" CreateGroup="yes" RemoveOnUninstall="yes" />
26 27
27 <util:Group Id="TEST_GROUP2" Name="testName2" Comment="Group2" RemoveOnUninstall="no" UpdateIfExists="yes" /> 28 <util:Group Id="TEST_GROUP2" Name="testName2" Comment="Group2" RemoveOnUninstall="no" UpdateIfExists="yes" />
29
30 <util:Group Id="TEST_GROUP3" Name="testName3" Domain="[TESTDOMAIN]" Comment="Group3" RemoveOnUninstall="no" UpdateIfExists="yes" />
28 </Component> 31 </Component>
29 </Fragment> 32 </Fragment>
30</Wix> 33</Wix>
diff --git a/src/test/msi/TestData/UtilExtensionGroupTests/ProductNewGroupWithComment/product.wxs b/src/test/msi/TestData/UtilExtensionGroupTests/ProductNewGroupWithComment/product.wxs
index 2d012b23..2305a80b 100644
--- a/src/test/msi/TestData/UtilExtensionGroupTests/ProductNewGroupWithComment/product.wxs
+++ b/src/test/msi/TestData/UtilExtensionGroupTests/ProductNewGroupWithComment/product.wxs
@@ -6,18 +6,15 @@
6 <ComponentGroup Id="ProductComponents"> 6 <ComponentGroup Id="ProductComponents">
7 <ComponentRef Id="Component1" /> 7 <ComponentRef Id="Component1" />
8 </ComponentGroup> 8 </ComponentGroup>
9
10 <Property Id="TESTDOMAIN" Secure="yes" />
9 </Fragment> 11 </Fragment>
10 12
11 <Fragment> 13 <Fragment>
12 <Component Id="Component1" Guid="00030829-0000-0000-C000-000000000046" Directory="INSTALLFOLDER"> 14 <Component Id="Component1" Guid="00030829-0000-0000-C000-000000000046" Directory="INSTALLFOLDER">
13 <File Source="$(sys.SOURCEFILEPATH)" KeyPath="yes" /> 15 <File Source="$(sys.SOURCEFILEPATH)" KeyPath="yes" />
14 <util:Group 16 <util:Group
15 Id="TEST_GROUP1" 17 Id="TEST_GROUP1" Name="testName1" CreateGroup="yes" UpdateIfExists="yes" RemoveOnUninstall="yes" Comment="testComment1" />
16 Name="testName1"
17 CreateGroup="yes"
18 UpdateIfExists="yes"
19 RemoveOnUninstall="yes"
20 Comment="testComment1" />
21 </Component> 18 </Component>
22 </Fragment> 19 </Fragment>
23</Wix> 20</Wix>
diff --git a/src/test/msi/TestData/UtilExtensionGroupTests/ProductNonVitalGroup/NonVitalUserGroup.wxs b/src/test/msi/TestData/UtilExtensionGroupTests/ProductNonVitalGroup/NonVitalUserGroup.wxs
index a834c76b..4922fcef 100644
--- a/src/test/msi/TestData/UtilExtensionGroupTests/ProductNonVitalGroup/NonVitalUserGroup.wxs
+++ b/src/test/msi/TestData/UtilExtensionGroupTests/ProductNonVitalGroup/NonVitalUserGroup.wxs
@@ -6,6 +6,8 @@
6 <ComponentGroup Id="ProductComponents"> 6 <ComponentGroup Id="ProductComponents">
7 <ComponentRef Id="Component1" /> 7 <ComponentRef Id="Component1" />
8 </ComponentGroup> 8 </ComponentGroup>
9
10 <Property Id="TESTDOMAIN" Secure="yes" />
9 </Fragment> 11 </Fragment>
10 12
11 <Fragment> 13 <Fragment>
diff --git a/src/test/msi/TestData/UtilExtensionGroupTests/ProductRestrictedDomain/RestrictedDomain.wxs b/src/test/msi/TestData/UtilExtensionGroupTests/ProductRestrictedDomain/RestrictedDomain.wxs
index edb3387c..04a1ac4e 100644
--- a/src/test/msi/TestData/UtilExtensionGroupTests/ProductRestrictedDomain/RestrictedDomain.wxs
+++ b/src/test/msi/TestData/UtilExtensionGroupTests/ProductRestrictedDomain/RestrictedDomain.wxs
@@ -7,14 +7,14 @@
7 <ComponentRef Id="Component1" /> 7 <ComponentRef Id="Component1" />
8 </ComponentGroup> 8 </ComponentGroup>
9 9
10 <Property Id="TEMPDOMAIN" Secure="yes" /> 10 <Property Id="TESTDOMAIN" Secure="yes" />
11 </Fragment> 11 </Fragment>
12 12
13 <Fragment> 13 <Fragment>
14 <Component Id="Component1" Guid="00030829-0000-0000-C000-000000000046" Directory="INSTALLFOLDER"> 14 <Component Id="Component1" Guid="00030829-0000-0000-C000-000000000046" Directory="INSTALLFOLDER">
15 <File Source="$(sys.SOURCEFILEPATH)" KeyPath="yes" /> 15 <File Source="$(sys.SOURCEFILEPATH)" KeyPath="yes" />
16 16
17 <util:Group Id="TEST_GROUP_test" Name="testName1" Domain="[TEMPDOMAIN]" /> 17 <util:Group Id="TEST_GROUP_test" Name="testName1" Domain="[TESTDOMAIN]" />
18 </Component> 18 </Component>
19 </Fragment> 19 </Fragment>
20</Wix> 20</Wix>
diff --git a/src/test/msi/TestData/UtilExtensionGroupTests/ProductWithCommandLineParameters/ProductWithCommandLineParameters.wxs b/src/test/msi/TestData/UtilExtensionGroupTests/ProductWithCommandLineParameters/ProductWithCommandLineParameters.wxs
index 059ecee8..36d10aa3 100644
--- a/src/test/msi/TestData/UtilExtensionGroupTests/ProductWithCommandLineParameters/ProductWithCommandLineParameters.wxs
+++ b/src/test/msi/TestData/UtilExtensionGroupTests/ProductWithCommandLineParameters/ProductWithCommandLineParameters.wxs
@@ -4,16 +4,13 @@
4 <ComponentGroup Id="ProductComponents"> 4 <ComponentGroup Id="ProductComponents">
5 <ComponentRef Id="Component1" /> 5 <ComponentRef Id="Component1" />
6 </ComponentGroup> 6 </ComponentGroup>
7
8 <Property Id="TESTDOMAIN" Secure="yes" />
7 </Fragment> 9 </Fragment>
8 10
9 <Fragment> 11 <Fragment>
10 <Component Id="Component1" 12 <Component Id="Component1" Guid="1FDC6C4D-7741-4BF1-A4F0-4231879CEC45" Directory="INSTALLFOLDER">
11 Guid="1FDC6C4D-7741-4BF1-A4F0-4231879CEC45" 13 <util:Group Id="TEST_GROUP1" Name="[TESTPARAMETER1]" Domain="[TESTDOMAIN]" CreateGroup="yes" RemoveOnUninstall="yes" />
12 Directory="INSTALLFOLDER">
13 <util:Group Id="TEST_GROUP1"
14 Name="[TESTPARAMETER1]"
15 CreateGroup="yes"
16 RemoveOnUninstall="yes" />
17 </Component> 14 </Component>
18 </Fragment> 15 </Fragment>
19</Wix> 16</Wix>
diff --git a/src/test/msi/WixToolsetTest.MsiE2E/UtilExtensionGroupTests.cs b/src/test/msi/WixToolsetTest.MsiE2E/UtilExtensionGroupTests.cs
index d7cf3168..cee357a6 100644
--- a/src/test/msi/WixToolsetTest.MsiE2E/UtilExtensionGroupTests.cs
+++ b/src/test/msi/WixToolsetTest.MsiE2E/UtilExtensionGroupTests.cs
@@ -11,9 +11,10 @@ namespace WixToolsetTest.MsiE2E
11 { 11 {
12 public UtilExtensionGroupTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } 12 public UtilExtensionGroupTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { }
13 13
14 #region Non Domain
14 // Verify that the users specified in the authoring are created as expected. 15 // Verify that the users specified in the authoring are created as expected.
15 [RuntimeFact] 16 [RuntimeFact]
16 public void CanInstallAndUninstallGroups() 17 public void CanInstallAndUninstallNonDomainGroups()
17 { 18 {
18 UserGroupVerifier.CreateLocalGroup("testName3"); 19 UserGroupVerifier.CreateLocalGroup("testName3");
19 var productA = this.CreatePackageInstaller("ProductA"); 20 var productA = this.CreatePackageInstaller("ProductA");
@@ -39,7 +40,7 @@ namespace WixToolsetTest.MsiE2E
39 40
40 // Verify the rollback action reverts all Users changes. 41 // Verify the rollback action reverts all Users changes.
41 [RuntimeFact] 42 [RuntimeFact]
42 public void CanRollbackGroups() 43 public void CanRollbackNonDomainGroups()
43 { 44 {
44 UserGroupVerifier.CreateLocalGroup("testName3"); 45 UserGroupVerifier.CreateLocalGroup("testName3");
45 var productFail = this.CreatePackageInstaller("ProductFail"); 46 var productFail = this.CreatePackageInstaller("ProductFail");
@@ -65,7 +66,7 @@ namespace WixToolsetTest.MsiE2E
65 // Original code signalled repair mode by using "-f ", which silently 66 // Original code signalled repair mode by using "-f ", which silently
66 // terminated the command-line parsing, ignoring any parameters that followed. 67 // terminated the command-line parsing, ignoring any parameters that followed.
67 [RuntimeFact()] 68 [RuntimeFact()]
68 public void CanRepairGroupsWithCommandLineParameters() 69 public void CanRepairNonDomainGroupsWithCommandLineParameters()
69 { 70 {
70 var arguments = new string[] 71 var arguments = new string[]
71 { 72 {
@@ -82,6 +83,10 @@ namespace WixToolsetTest.MsiE2E
82 // Repair 83 // Repair
83 productWithCommandLineParameters.RepairProduct(MSIExec.MSIExecReturnCode.SUCCESS, arguments); 84 productWithCommandLineParameters.RepairProduct(MSIExec.MSIExecReturnCode.SUCCESS, arguments);
84 85
86
87 // Install
88 productWithCommandLineParameters.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS, arguments);
89
85 // Clean up 90 // Clean up
86 UserGroupVerifier.DeleteLocalGroup("testName1"); 91 UserGroupVerifier.DeleteLocalGroup("testName1");
87 } 92 }
@@ -89,7 +94,7 @@ namespace WixToolsetTest.MsiE2E
89 94
90 // Verify that the groups specified in the authoring are created as expected on repair. 95 // Verify that the groups specified in the authoring are created as expected on repair.
91 [RuntimeFact()] 96 [RuntimeFact()]
92 public void CanRepairGroups() 97 public void CanRepairNonDomainGroups()
93 { 98 {
94 UserGroupVerifier.CreateLocalGroup("testName3"); 99 UserGroupVerifier.CreateLocalGroup("testName3");
95 var productA = this.CreatePackageInstaller("ProductA"); 100 var productA = this.CreatePackageInstaller("ProductA");
@@ -119,7 +124,7 @@ namespace WixToolsetTest.MsiE2E
119 124
120 // Verify that Installation fails if FailIfExists is set. 125 // Verify that Installation fails if FailIfExists is set.
121 [RuntimeFact] 126 [RuntimeFact]
122 public void FailsIfGroupExists() 127 public void FailsIfNonDomainGroupExists()
123 { 128 {
124 var productFailIfExists = this.CreatePackageInstaller("ProductFailIfExists"); 129 var productFailIfExists = this.CreatePackageInstaller("ProductFailIfExists");
125 130
@@ -148,7 +153,7 @@ namespace WixToolsetTest.MsiE2E
148 { 153 {
149 var productRestrictedDomain = this.CreatePackageInstaller("ProductRestrictedDomain"); 154 var productRestrictedDomain = this.CreatePackageInstaller("ProductRestrictedDomain");
150 155
151 string logFile = productRestrictedDomain.InstallProduct(MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE, "TEMPDOMAIN=DOESNOTEXIST"); 156 string logFile = productRestrictedDomain.InstallProduct(MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE, "TESTDOMAIN=DOESNOTEXIST");
152 157
153 // Verify expected error message in the log file 158 // Verify expected error message in the log file
154 Assert.True(LogVerifier.MessageInLogFile(logFile, "CreateGroup: Error 0x8007054b: failed to find Domain DOESNOTEXIST.")); 159 Assert.True(LogVerifier.MessageInLogFile(logFile, "CreateGroup: Error 0x8007054b: failed to find Domain DOESNOTEXIST."));
@@ -156,12 +161,13 @@ namespace WixToolsetTest.MsiE2E
156 161
157 // Verify that a group can be created with a group comment 162 // Verify that a group can be created with a group comment
158 [RuntimeFact] 163 [RuntimeFact]
159 public void CanCreateNewGroupWithComment() 164 public void CanCreateNewNonDomainGroupWithComment()
160 { 165 {
161 var productNewUserWithComment = this.CreatePackageInstaller("ProductNewGroupWithComment"); 166 var productNewUserWithComment = this.CreatePackageInstaller("ProductNewGroupWithComment");
162 167
163 productNewUserWithComment.InstallProduct(); 168 productNewUserWithComment.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS);
164 UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", "testComment1"); 169 UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", "testComment1");
170 productNewUserWithComment.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS);
165 171
166 // clean up 172 // clean up
167 UserGroupVerifier.DeleteLocalGroup("testName1"); 173 UserGroupVerifier.DeleteLocalGroup("testName1");
@@ -169,30 +175,33 @@ namespace WixToolsetTest.MsiE2E
169 175
170 // Verify that a comment can be added to an existing group 176 // Verify that a comment can be added to an existing group
171 [RuntimeFact] 177 [RuntimeFact]
172 public void CanAddCommentToExistingGroup() 178 public void CanAddCommentToExistingNonDomainGroup()
173 { 179 {
174 UserGroupVerifier.CreateLocalGroup("testName1"); 180 UserGroupVerifier.CreateLocalGroup("testName1");
175 var productAddCommentToExistingUser = this.CreatePackageInstaller("ProductAddCommentToExistingGroup"); 181 var productAddCommentToExistingUser = this.CreatePackageInstaller("ProductAddCommentToExistingGroup");
176 182
177 productAddCommentToExistingUser.InstallProduct(); 183 productAddCommentToExistingUser.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS);
178 184
179 UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", "testComment1"); 185 UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", "testComment1");
180 186
187 productAddCommentToExistingUser.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS);
188
181 // clean up 189 // clean up
182 UserGroupVerifier.DeleteLocalGroup("testName1"); 190 UserGroupVerifier.DeleteLocalGroup("testName1");
183 } 191 }
184 192
185 // Verify that a comment can be repaired for a new group 193 // Verify that a comment can be repaired for a new group
186 [RuntimeFact] 194 [RuntimeFact]
187 public void CanRepairCommentOfNewGroup() 195 public void CanRepairCommentOfNewNonDomainGroup()
188 { 196 {
189 var productNewUserWithComment = this.CreatePackageInstaller("ProductNewGroupWithComment"); 197 var productNewUserWithComment = this.CreatePackageInstaller("ProductNewGroupWithComment");
190 198
191 productNewUserWithComment.InstallProduct(); 199 productNewUserWithComment.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS);
192 UserGroupVerifier.SetGroupComment(String.Empty, "testName1", ""); 200 UserGroupVerifier.SetGroupComment(String.Empty, "testName1", "");
193 201
194 productNewUserWithComment.RepairProduct(); 202 productNewUserWithComment.RepairProduct(MSIExec.MSIExecReturnCode.SUCCESS);
195 UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", "testComment1"); 203 UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", "testComment1");
204 productNewUserWithComment.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS);
196 205
197 // clean up 206 // clean up
198 UserGroupVerifier.DeleteLocalGroup("testName1"); 207 UserGroupVerifier.DeleteLocalGroup("testName1");
@@ -200,14 +209,15 @@ namespace WixToolsetTest.MsiE2E
200 209
201 // Verify that a comment can be changed for an existing group 210 // Verify that a comment can be changed for an existing group
202 [RuntimeFact] 211 [RuntimeFact]
203 public void CanChangeCommentOfExistingGroup() 212 public void CanChangeCommentOfExistingNonDomainGroup()
204 { 213 {
205 UserGroupVerifier.CreateLocalGroup("testName1"); 214 UserGroupVerifier.CreateLocalGroup("testName1");
206 UserGroupVerifier.SetGroupComment(String.Empty, "testName1", "initialTestComment1"); 215 UserGroupVerifier.SetGroupComment(String.Empty, "testName1", "initialTestComment1");
207 var productNewUserWithComment = this.CreatePackageInstaller("ProductNewGroupWithComment"); 216 var productNewUserWithComment = this.CreatePackageInstaller("ProductNewGroupWithComment");
208 217
209 productNewUserWithComment.InstallProduct(); 218 productNewUserWithComment.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS);
210 UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", "testComment1"); 219 UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", "testComment1");
220 productNewUserWithComment.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS);
211 221
212 // clean up 222 // clean up
213 UserGroupVerifier.DeleteLocalGroup("testName1"); 223 UserGroupVerifier.DeleteLocalGroup("testName1");
@@ -215,7 +225,7 @@ namespace WixToolsetTest.MsiE2E
215 225
216 // Verify that a comment can be rolled back for an existing group 226 // Verify that a comment can be rolled back for an existing group
217 [RuntimeFact] 227 [RuntimeFact]
218 public void CanRollbackCommentOfExistingGroup() 228 public void CanRollbackCommentOfExistingNonDomainGroup()
219 { 229 {
220 UserGroupVerifier.CreateLocalGroup("testName1"); 230 UserGroupVerifier.CreateLocalGroup("testName1");
221 UserGroupVerifier.SetGroupComment(String.Empty, "testName1", "initialTestComment1"); 231 UserGroupVerifier.SetGroupComment(String.Empty, "testName1", "initialTestComment1");
@@ -232,7 +242,7 @@ namespace WixToolsetTest.MsiE2E
232 242
233 // Verify that a comment can be deleted for an existing group 243 // Verify that a comment can be deleted for an existing group
234 [RuntimeFact] 244 [RuntimeFact]
235 public void CanDeleteCommentOfExistingGroup() 245 public void CanDeleteCommentOfExistingNonDomainGroup()
236 { 246 {
237 UserGroupVerifier.CreateLocalGroup("testName1"); 247 UserGroupVerifier.CreateLocalGroup("testName1");
238 UserGroupVerifier.SetGroupComment(String.Empty, "testName1", "testComment1"); 248 UserGroupVerifier.SetGroupComment(String.Empty, "testName1", "testComment1");
@@ -243,29 +253,64 @@ namespace WixToolsetTest.MsiE2E
243 // Verify that comment was removed. 253 // Verify that comment was removed.
244 UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", ""); 254 UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", "");
245 255
256
257 productCommentDelete.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS);
258
246 // clean up 259 // clean up
247 UserGroupVerifier.DeleteLocalGroup("testName1"); 260 UserGroupVerifier.DeleteLocalGroup("testName1");
248 } 261 }
249 262
250 // Verify that a comment can be deleted for an existing group 263 #endregion
251 [RuntimeFact] 264
252 public void CanNestGroups() 265 #region Domain
266 // Verify that a domain group can be nested within a local group
267 [RuntimeFact(DomainRequired = true)]
268 public void CanNestDomainGroups()
253 { 269 {
270 var testDomain = System.Environment.UserDomainName;
254 var productNestedGroups = this.CreatePackageInstaller("ProductNestedGroups"); 271 var productNestedGroups = this.CreatePackageInstaller("ProductNestedGroups");
255 272
256 productNestedGroups.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); 273 productNestedGroups.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS, $"TESTDOMAIN={testDomain}");
257 274
258 // Verify group nested membership 275 // Verify group nested membership
259 UserGroupVerifier.VerifyIsMemberOf(String.Empty, "Authenticated Users", new string[] { "testName1", "testName2" }); 276 UserGroupVerifier.VerifyIsMemberOf(testDomain, "Domain Users", new string[] { "testName1", "testName2" });
260 UserGroupVerifier.VerifyIsMemberOf(String.Empty, "Everyone", new string[] { "testName1" }); 277 //UserGroupVerifier.VerifyIsMemberOf(String.Empty, "Everyone", new string[] { "testName1" });
278
279 UserGroupVerifier.VerifyIsNotMemberOf(testDomain, "Domain Users", new string[] { "testName3" });
280 //UserGroupVerifier.VerifyIsNotMemberOf(String.Empty, "Everyone", new string[] { "testName2", "testName3" });
261 281
262 UserGroupVerifier.VerifyIsNotMemberOf(String.Empty, "Authenticated Users", new string[] { "testName3" }); 282 productNestedGroups.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS, $"TESTDOMAIN={testDomain}");
263 UserGroupVerifier.VerifyIsNotMemberOf(String.Empty, "Everyone", new string[] { "testName2", "testName3" });
264 283
265 // clean up 284 // clean up
266 UserGroupVerifier.DeleteLocalGroup("testName1"); 285 UserGroupVerifier.DeleteLocalGroup("testName1");
267 UserGroupVerifier.DeleteLocalGroup("testName2"); 286 UserGroupVerifier.DeleteLocalGroup("testName2");
268 UserGroupVerifier.DeleteLocalGroup("testName3"); 287 UserGroupVerifier.DeleteLocalGroup("testName3");
269 } 288 }
289
290 // Verify the rollback action reverts all Users changes.
291 [RuntimeFact(DomainRequired = true)]
292 public void CanRollbackDomainGroups()
293 {
294 var testDomain = System.Environment.UserDomainName;
295 UserGroupVerifier.CreateLocalGroup("testName3");
296 var productFail = this.CreatePackageInstaller("ProductFail");
297
298 // make sure the user accounts are deleted before we start
299 UserGroupVerifier.DeleteLocalGroup("testName1");
300 UserGroupVerifier.DeleteLocalGroup("testName2");
301
302 productFail.InstallProduct(MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE, $"TESTDOMAIN={testDomain}");
303
304 // Verify added Users were removed on rollback.
305 Assert.False(UserGroupVerifier.GroupExists(String.Empty, "testName1"), String.Format("Group '{0}' was not removed on Rollback", "testName1"));
306 Assert.False(UserGroupVerifier.GroupExists(String.Empty, "testName2"), String.Format("Group '{0}' was not removed on Rollback", "testName2"));
307
308 // clean up
309 UserGroupVerifier.DeleteLocalGroup("testName1");
310 UserGroupVerifier.DeleteLocalGroup("testName2");
311 UserGroupVerifier.DeleteLocalGroup("testName3");
312 }
313
314 #endregion
270 } 315 }
271} 316}
diff --git a/src/test/msi/WixToolsetTest.MsiE2E/runtests.cmd b/src/test/msi/WixToolsetTest.MsiE2E/runtests.cmd
index a2e67c89..ed1d50b6 100644
--- a/src/test/msi/WixToolsetTest.MsiE2E/runtests.cmd
+++ b/src/test/msi/WixToolsetTest.MsiE2E/runtests.cmd
@@ -1,2 +1,3 @@
1SET RuntimeTestsEnabled=true 1SET RuntimeTestsEnabled=true
2SET RuntimeDomainTestsEnabled=true
2dotnet test WixToolsetTest.MsiE2E.dll -v normal --logger trx 3dotnet test WixToolsetTest.MsiE2E.dll -v normal --logger trx