From 3d970b5fe42f5dbdd8b6239fff004422f771eafa Mon Sep 17 00:00:00 2001 From: zentron Date: Wed, 16 Mar 2022 22:29:05 +1000 Subject: [PATCH 01/15] Add terraform script for provisioning AD resources --- .gitignore | 4 + source/Ldap.Integration.Tests/README.md | 41 ++--- .../TestHelpers/ConfigurationHelper.cs | 4 +- ...iveDirectoryIntegrationTestEnvironment.ps1 | 15 ++ ...iveDirectoryIntegrationTestEnvironment.ps1 | 6 + .../Scripts/ConfigureActiveDirectoryData.ps1} | 0 .../InstallActiveDirectoryServices.ps1 | 19 ++ .../scripts/ActiveDirectory/Azure/main.tf | 170 ++++++++++++++++++ .../scripts/ActiveDirectory/Azure/output.tf | 22 +++ .../ActiveDirectory/Azure/variables.tf | 4 + ...ove-ActiveDirectoryIntegrationTestData.ps1 | 15 -- .../scripts/OpenLdap/Dockerfile | 2 +- .../scripts/OpenLdap/docker-compose.yml | 2 +- 13 files changed, 262 insertions(+), 42 deletions(-) create mode 100644 source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/New-ActiveDirectoryIntegrationTestEnvironment.ps1 create mode 100644 source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/Remove-ActiveDirectoryIntegrationTestEnvironment.ps1 rename source/Ldap.Integration.Tests/scripts/ActiveDirectory/{Update-ActiveDirectoryIntegrationTestData.ps1 => Azure/Scripts/ConfigureActiveDirectoryData.ps1} (100%) create mode 100644 source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/Scripts/InstallActiveDirectoryServices.ps1 create mode 100644 source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/main.tf create mode 100644 source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/output.tf create mode 100644 source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/variables.tf delete mode 100644 source/Ldap.Integration.Tests/scripts/ActiveDirectory/Remove-ActiveDirectoryIntegrationTestData.ps1 diff --git a/.gitignore b/.gitignore index f5c99bc..b3fd50b 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,7 @@ TestResult.xml !packages.config .idea **/launchSettings.json + +.terraform/ +terraform.tfstate* +.terraform* \ No newline at end of file diff --git a/source/Ldap.Integration.Tests/README.md b/source/Ldap.Integration.Tests/README.md index a0cc7a2..8acf3c8 100644 --- a/source/Ldap.Integration.Tests/README.md +++ b/source/Ldap.Integration.Tests/README.md @@ -10,12 +10,12 @@ A docker-compose stack is defined that spins up an openldap server bootstrapped Environment variables can be used to configure the integration test settings. -| Env Var | Required | Default Value | -| --- | --- | --- | -| `OCTOPUS_LDAP_OPENLDAP_SERVER` | No | localhost | -| `OCTOPUS_LDAP_OPENLDAP_PORT` | No | 389 | +| Env Var | Required | Default Value | +| --- | --- |------------------------------| +| `OCTOPUS_LDAP_OPENLDAP_SERVER` | No | localhost | +| `OCTOPUS_LDAP_OPENLDAP_PORT` | No | 389 | | `OCTOPUS_LDAP_OPENLDAP_USER` | No | cn=admin,dc=domain1,dc=local | -| `OCTOPUS_LDAP_OPENLDAP_PASSWORD` | Yes | | +| `OCTOPUS_LDAP_OPENLDAP_PASSWORD` | Yes | Pass | ### Running Integration Tests @@ -34,34 +34,29 @@ Powershell scripts are located [here](scripts/OpenLdap) to create/tear down the ``` ## Active Directory - As it is not possible to containerize Microsoft AD, these need to be run against a VM hosted instance somewhere that gets populated with known test data. -[This Azure Template](https://github.com/maxskunkworks/TLG/tree/master/tlg-base-config_3-vm) is one relatively straight forward option to create an AD environment. Firewall settings will generally need to applied manually to enable inbound connections. - ### Configuration Environment variables can be used to configure the integration test settings. -| Env Var | Required | Default Value | -| --- | --- | --- | -| `OCTOPUS_LDAP_AD_SERVER` | Yes | | -| `OCTOPUS_LDAP_AD_PORT` | No | 389 | -| `OCTOPUS_LDAP_AD_USER` | Yes | | +| Env Var | Required | Default Value | +| --- | --- |---------------------------| +| `OCTOPUS_LDAP_AD_SERVER` | Yes | | +| `OCTOPUS_LDAP_AD_PORT` | No | 389 | +| `OCTOPUS_LDAP_AD_USER` | Yes | adminuser@mycompany.local | | `OCTOPUS_LDAP_AD_PASSWORD` | Yes | | ### Running Integration Tests +A terraform script has been provided [here](scripts/ActiveDirectory/Azure) that will provision an AD instance in Azure along with relevant test data. -Powershell scripts are located [here](scripts/ActiveDirectory) to populate an existing ActiveDirectory instance with the required test data. Due to cross platform and other limmitations, they currently are simple scripts that must be run from a machine connected to the test domain using an account with appropriate permissions. - -- Populate the integration test data +- Create the integration test stack ``` -./Update-ActiveDirectoryIntegrationTestData.ps1 +./New-ActiveDirectoryIntegrationTestEnvironment.ps1 ``` - -- Run the ActiveDirectory integration tests - -- Cleanup the integration test data +- Update your environment variables with the generated server IP and password. +- Run the OpenLdap integration tests +- Tear down the integration test stack +``` +./Remove-ActiveDirectoryIntegrationTestEnvironment.ps1 ``` -./Remove-ActiveDirectoryIntegrationTestData.ps1 -``` \ No newline at end of file diff --git a/source/Ldap.Integration.Tests/TestHelpers/ConfigurationHelper.cs b/source/Ldap.Integration.Tests/TestHelpers/ConfigurationHelper.cs index 04e094e..c622c1d 100644 --- a/source/Ldap.Integration.Tests/TestHelpers/ConfigurationHelper.cs +++ b/source/Ldap.Integration.Tests/TestHelpers/ConfigurationHelper.cs @@ -19,7 +19,7 @@ public static LdapConfiguration GetActiveDirectoryConfiguration() { var server = Environment.GetEnvironmentVariable(ENVVAR_AD_SERVER); var port = Convert.ToInt32(Environment.GetEnvironmentVariable(ENVVAR_AD_PORT) ?? "389"); - var user = Environment.GetEnvironmentVariable(ENVVAR_AD_USER); + var user = Environment.GetEnvironmentVariable(ENVVAR_AD_USER) ?? "adminuser@mycompany.local"; var password = Environment.GetEnvironmentVariable(ENVVAR_AD_PASSWORD); return new LdapConfiguration() @@ -51,7 +51,7 @@ public static LdapConfiguration GetOpenLdapConfiguration() var server = Environment.GetEnvironmentVariable(ENVVAR_OPENLDAP_SERVER) ?? "localhost"; var port = Convert.ToInt32(Environment.GetEnvironmentVariable(ENVVAR_OPENLDAP_PORT) ?? "389"); var user = Environment.GetEnvironmentVariable(ENVVAR_OPENLDAP_USER) ?? "cn=admin,dc=domain1,dc=local"; - var password = Environment.GetEnvironmentVariable(ENVVAR_OPENLDAP_PASSWORD); + var password = Environment.GetEnvironmentVariable(ENVVAR_OPENLDAP_PASSWORD) ?? "Pass"; return new LdapConfiguration() .Enabled() diff --git a/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/New-ActiveDirectoryIntegrationTestEnvironment.ps1 b/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/New-ActiveDirectoryIntegrationTestEnvironment.ps1 new file mode 100644 index 0000000..4aeb9a6 --- /dev/null +++ b/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/New-ActiveDirectoryIntegrationTestEnvironment.ps1 @@ -0,0 +1,15 @@ +Write-Output "Setting up Azure AD Terraform stack" + +terraform init +terraform plan +terraform apply --auto-approve + +#We ned to refresh the state since the public vm IP isn't allocated when the resource is first provisioned +terraform refresh + +$output=(terraform output -json | ConvertFrom-json) +Write-Host "Update your Environment Variables" +Write-Host " ENVVAR_AD_SERVER=$($output.public_ip_addr.value)" +Write-Host " ENVVAR_AD_USER=$($output.admin_username.value)@mycompany.local" +Write-Host " ENVVAR_AD_PASSWORD=$($output.admin_password.value)" + diff --git a/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/Remove-ActiveDirectoryIntegrationTestEnvironment.ps1 b/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/Remove-ActiveDirectoryIntegrationTestEnvironment.ps1 new file mode 100644 index 0000000..bc20ae5 --- /dev/null +++ b/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/Remove-ActiveDirectoryIntegrationTestEnvironment.ps1 @@ -0,0 +1,6 @@ +Write-Output "Tearing down Azure AD Terraform stack" + +terraform destroy --auto-approve + +Write-Output "DONE!" +exit 0 \ No newline at end of file diff --git a/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Update-ActiveDirectoryIntegrationTestData.ps1 b/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/Scripts/ConfigureActiveDirectoryData.ps1 similarity index 100% rename from source/Ldap.Integration.Tests/scripts/ActiveDirectory/Update-ActiveDirectoryIntegrationTestData.ps1 rename to source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/Scripts/ConfigureActiveDirectoryData.ps1 diff --git a/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/Scripts/InstallActiveDirectoryServices.ps1 b/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/Scripts/InstallActiveDirectoryServices.ps1 new file mode 100644 index 0000000..ead4b81 --- /dev/null +++ b/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/Scripts/InstallActiveDirectoryServices.ps1 @@ -0,0 +1,19 @@ +Write-Host $(Get-Date) " >> Starting" + +Import-Module ServerManager +Install-windowsfeature -name AD-Domain-Services –IncludeManagementTools +Install-WindowsFeature –Name GPMC +Write-Host $(Get-Date) " >> Tools Installed" + + +$domainname = "mycompany.local" +$NTDPath = "C:\Windows\ntds" +$logPath = "C:\Windows\ntds" +$sysvolPath = "C:\Windows\Sysvol" +$domainmode = "win2012R2" +$forestmode = "win2012R2" +$password = ConvertTo-SecureString "AdminPassword01!!" -AsPlainText -Force +Install-ADDSForest -CreateDnsDelegation:$false -DatabasePath $NTDPath -SafeModeAdministratorPassword $password -DomainMode $domainmode -DomainName $domainname -ForestMode $forestmode -InstallDns:$true -LogPath $logPath -NoRebootOnCompletion:$true -SysvolPath $sysvolPath -Force:$true +Write-Host $(Get-Date) " >> AD Configured" + +shutdown /f /r /t 1 \ No newline at end of file diff --git a/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/main.tf b/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/main.tf new file mode 100644 index 0000000..473e14c --- /dev/null +++ b/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/main.tf @@ -0,0 +1,170 @@ +terraform { + required_version = ">=0.12" + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "~>2.0" + } + } +} + +provider "azurerm" { + features {} +} + + +## +resource "azurerm_resource_group" "rg" { + name = "rg_authtest_ad" + location = var.resource_group_location +} + +## +resource "azurerm_virtual_network" "vnet" { + name = "vNet1" + address_space = ["10.0.0.0/16"] + location = azurerm_resource_group.rg.location + resource_group_name = azurerm_resource_group.rg.name +} + +## +resource "azurerm_subnet" "subnet" { + name = "subnet" + resource_group_name = azurerm_resource_group.rg.name + virtual_network_name = azurerm_virtual_network.vnet.name + address_prefixes = ["10.0.2.0/24"] +} + +resource "azurerm_public_ip" "public_ip" { + name = "public_ip" + resource_group_name = azurerm_resource_group.rg.name + location = azurerm_resource_group.rg.location + allocation_method = "Dynamic" +} + +## +resource "azurerm_network_interface" "example" { + name = "nic1" + location = azurerm_resource_group.rg.location + resource_group_name = azurerm_resource_group.rg.name + + + ip_configuration { + name = "internal" + subnet_id = azurerm_subnet.subnet.id + private_ip_address_allocation = "Dynamic" + public_ip_address_id = azurerm_public_ip.public_ip.id + } +} + +# Create Network Security Group and rule +resource "azurerm_network_security_group" "myterraformnsg" { + name = "securitygroup" + location = azurerm_resource_group.rg.location + resource_group_name = azurerm_resource_group.rg.name + + security_rule { + name = "LDAP" + priority = 1002 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "389" + source_address_prefix = "*" + destination_address_prefix = "*" + } +} + +resource "azurerm_network_interface_security_group_association" "example" { + network_interface_id = azurerm_network_interface.example.id + network_security_group_id = azurerm_network_security_group.myterraformnsg.id +} + + +resource "random_password" "password" { + length = 16 + special = true + override_special = "_%@" +} + +## +resource "azurerm_windows_virtual_machine" "example" { + name = "ad-vm" + resource_group_name = azurerm_resource_group.rg.name + location = azurerm_resource_group.rg.location + size = "Standard_F2" + admin_username = "adminuser" + admin_password = random_password.password.result + network_interface_ids = [ + azurerm_network_interface.example.id, + ] + + os_disk { + caching = "ReadWrite" + storage_account_type = "Standard_LRS" + } + + source_image_reference { + publisher = "MicrosoftWindowsServer" + offer = "WindowsServer" + sku = "2016-Datacenter" + version = "latest" + } +} + +#Provisioning the AD Services +resource "azurerm_virtual_machine_extension" "ad_install" { + name = "Active_Directory_Installation" + virtual_machine_id = azurerm_windows_virtual_machine.example.id + publisher = "Microsoft.Compute" + type = "CustomScriptExtension" + type_handler_version = "1.10" + + protected_settings = < Date: Tue, 29 Mar 2022 14:34:54 +1000 Subject: [PATCH 02/15] Update New-ActiveDirectoryIntegrationTestEnvironment.ps1 Updated the expected environment variables --- .../New-ActiveDirectoryIntegrationTestEnvironment.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/New-ActiveDirectoryIntegrationTestEnvironment.ps1 b/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/New-ActiveDirectoryIntegrationTestEnvironment.ps1 index 4aeb9a6..32c37a1 100644 --- a/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/New-ActiveDirectoryIntegrationTestEnvironment.ps1 +++ b/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/New-ActiveDirectoryIntegrationTestEnvironment.ps1 @@ -9,7 +9,8 @@ terraform refresh $output=(terraform output -json | ConvertFrom-json) Write-Host "Update your Environment Variables" -Write-Host " ENVVAR_AD_SERVER=$($output.public_ip_addr.value)" -Write-Host " ENVVAR_AD_USER=$($output.admin_username.value)@mycompany.local" -Write-Host " ENVVAR_AD_PASSWORD=$($output.admin_password.value)" +Write-Host " OCTOPUS_LDAP_AD_SERVER=$($output.public_ip_addr.value)" +Write-Host " OCTOPUS_LDAP_AD_USER=$($output.admin_username.value)@mycompany.local" +Write-Host " OCTOPUS_LDAP_AD_PASSWORD=$($output.admin_password.value)" +Write-Host " OCTOPUS_LDAP_AD_PORT=389" From ff3bb46f5824f9dceca8c69b4f1114865e5af547 Mon Sep 17 00:00:00 2001 From: zentron Date: Tue, 29 Mar 2022 16:11:46 +1000 Subject: [PATCH 03/15] Add bash scripts for provisioning --- .../TestHelpers/ConfigurationHelper.cs | 4 ++-- .../scripts/ActiveDirectory/Azure/main.tf | 1 - .../New-OpenLdapIntegrationTestEnvironment.sh | 16 ++++++++++++++++ .../Remove-OpenLdapIntegrationTestEnvironment.sh | 13 +++++++++++++ 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 source/Ldap.Integration.Tests/scripts/OpenLdap/New-OpenLdapIntegrationTestEnvironment.sh create mode 100644 source/Ldap.Integration.Tests/scripts/OpenLdap/Remove-OpenLdapIntegrationTestEnvironment.sh diff --git a/source/Ldap.Integration.Tests/TestHelpers/ConfigurationHelper.cs b/source/Ldap.Integration.Tests/TestHelpers/ConfigurationHelper.cs index c622c1d..2fc6057 100644 --- a/source/Ldap.Integration.Tests/TestHelpers/ConfigurationHelper.cs +++ b/source/Ldap.Integration.Tests/TestHelpers/ConfigurationHelper.cs @@ -17,10 +17,10 @@ internal static class ConfigurationHelper public static LdapConfiguration GetActiveDirectoryConfiguration() { - var server = Environment.GetEnvironmentVariable(ENVVAR_AD_SERVER); + var server = Environment.GetEnvironmentVariable(ENVVAR_AD_SERVER) ?? "20.231.14.150"; var port = Convert.ToInt32(Environment.GetEnvironmentVariable(ENVVAR_AD_PORT) ?? "389"); var user = Environment.GetEnvironmentVariable(ENVVAR_AD_USER) ?? "adminuser@mycompany.local"; - var password = Environment.GetEnvironmentVariable(ENVVAR_AD_PASSWORD); + var password = Environment.GetEnvironmentVariable(ENVVAR_AD_PASSWORD) ?? "Z@qDBHRXQmwoXBTs"; return new LdapConfiguration() .Enabled() diff --git a/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/main.tf b/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/main.tf index 473e14c..b1b3e59 100644 --- a/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/main.tf +++ b/source/Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/main.tf @@ -12,7 +12,6 @@ provider "azurerm" { features {} } - ## resource "azurerm_resource_group" "rg" { name = "rg_authtest_ad" diff --git a/source/Ldap.Integration.Tests/scripts/OpenLdap/New-OpenLdapIntegrationTestEnvironment.sh b/source/Ldap.Integration.Tests/scripts/OpenLdap/New-OpenLdapIntegrationTestEnvironment.sh new file mode 100644 index 0000000..bd68fbf --- /dev/null +++ b/source/Ldap.Integration.Tests/scripts/OpenLdap/New-OpenLdapIntegrationTestEnvironment.sh @@ -0,0 +1,16 @@ +#$composeFile = Join-Path $PSScriptRoot "docker-compose.yml" + +echo "Building local ldap container image with test data" +docker-compose -f docker-compose.yml build + +echo "Firing up openldap stack" +docker-compose -f docker-compose.yml up -d + +#$dockerExitCode = $LastExitCode + +#if ($dockerExitCode -ne 0) { +# throw "Failed! docker-compose returned $dockerExitCode" +#} + +echo "DONE!" +exit 0 \ No newline at end of file diff --git a/source/Ldap.Integration.Tests/scripts/OpenLdap/Remove-OpenLdapIntegrationTestEnvironment.sh b/source/Ldap.Integration.Tests/scripts/OpenLdap/Remove-OpenLdapIntegrationTestEnvironment.sh new file mode 100644 index 0000000..8441513 --- /dev/null +++ b/source/Ldap.Integration.Tests/scripts/OpenLdap/Remove-OpenLdapIntegrationTestEnvironment.sh @@ -0,0 +1,13 @@ +#$composeFile = Join-Path $PSScriptRoot "docker-compose.yml" + +echo "Tearing down openldap stack" +docker-compose -f docker-compose.yml down + +#$dockerExitCode = $LastExitCode + +#if ($dockerExitCode -ne 0) { +# throw "Failed! docker-compose returned $dockerExitCode" +#} + +echo "DONE!" +exit 0 \ No newline at end of file From dd8d2e78b9aabaac69b0505385c8bccf4ac64e45 Mon Sep 17 00:00:00 2001 From: zentron Date: Sat, 9 Apr 2022 23:04:02 +1000 Subject: [PATCH 04/15] Add OpenLdap Integration test --- source/Ldap.Integration.Tests/ICanMatchExternalUserTests.cs | 1 + source/Ldap.Integration.Tests/ICanSearchExternalGroupsTests.cs | 2 ++ source/Ldap.Integration.Tests/ICanSearchExternalUsersTests.cs | 1 + source/Ldap.Integration.Tests/IDoesBasicAuthenticationTests.cs | 1 + source/Ldap.Integration.Tests/IExternalGroupRetrieverTests.cs | 2 ++ .../ISupportsAutoUserCreationFromPrincipalTests.cs | 1 + .../Ldap.Integration.Tests/scripts/OpenLdap/docker-compose.yml | 2 +- 7 files changed, 9 insertions(+), 1 deletion(-) diff --git a/source/Ldap.Integration.Tests/ICanMatchExternalUserTests.cs b/source/Ldap.Integration.Tests/ICanMatchExternalUserTests.cs index 8d0d389..9fd6472 100644 --- a/source/Ldap.Integration.Tests/ICanMatchExternalUserTests.cs +++ b/source/Ldap.Integration.Tests/ICanMatchExternalUserTests.cs @@ -37,6 +37,7 @@ internal void MatchesAUserFromActiveDirectory() } [Fact] + [Trait("AuthProvider","OpenLDAP")] internal void MatchesAUserFromOpenLDAP() { var userName = "developer1"; diff --git a/source/Ldap.Integration.Tests/ICanSearchExternalGroupsTests.cs b/source/Ldap.Integration.Tests/ICanSearchExternalGroupsTests.cs index 0d963ee..09ed2ee 100644 --- a/source/Ldap.Integration.Tests/ICanSearchExternalGroupsTests.cs +++ b/source/Ldap.Integration.Tests/ICanSearchExternalGroupsTests.cs @@ -56,6 +56,7 @@ internal void FindsGroupsFromActiveDirectoryWithSpecialCharacters() } [Fact] + [Trait("AuthProvider","OpenLDAP")] internal void FindsGroupsFromOpenLDAP() { var partialName = "Devel"; @@ -74,6 +75,7 @@ internal void FindsGroupsFromOpenLDAP() } [Fact] + [Trait("AuthProvider","OpenLDAP")] internal void FindsGroupsFromOpenLDAPWithSpecialCharacters() { var partialName = "Special"; diff --git a/source/Ldap.Integration.Tests/ICanSearchExternalUsersTests.cs b/source/Ldap.Integration.Tests/ICanSearchExternalUsersTests.cs index 0f4d286..865e9a8 100644 --- a/source/Ldap.Integration.Tests/ICanSearchExternalUsersTests.cs +++ b/source/Ldap.Integration.Tests/ICanSearchExternalUsersTests.cs @@ -35,6 +35,7 @@ internal void FindsUsersFromActiveDirectory() } [Fact] + [Trait("AuthProvider","OpenLDAP")] internal void FindsUsersFromOpenLDAP() { var partialName = "devel"; diff --git a/source/Ldap.Integration.Tests/IDoesBasicAuthenticationTests.cs b/source/Ldap.Integration.Tests/IDoesBasicAuthenticationTests.cs index 4a1d3b7..097665c 100644 --- a/source/Ldap.Integration.Tests/IDoesBasicAuthenticationTests.cs +++ b/source/Ldap.Integration.Tests/IDoesBasicAuthenticationTests.cs @@ -45,6 +45,7 @@ internal void ValidatesAUserFromActiveDirectory() } [Fact] + [Trait("AuthProvider","OpenLDAP")] internal void ValidatesAUserFromOpenLDAP() { // Arrange diff --git a/source/Ldap.Integration.Tests/IExternalGroupRetrieverTests.cs b/source/Ldap.Integration.Tests/IExternalGroupRetrieverTests.cs index 9026056..40e9548 100644 --- a/source/Ldap.Integration.Tests/IExternalGroupRetrieverTests.cs +++ b/source/Ldap.Integration.Tests/IExternalGroupRetrieverTests.cs @@ -77,6 +77,7 @@ internal void ReadsGroupsForAUserFromActiveDirectoryWithSpecialCharacters() } [Fact] + [Trait("AuthProvider","OpenLDAP")] internal void ReadsGroupsForAUserFromOpenLDAP() { // Arrange @@ -107,6 +108,7 @@ internal void ReadsGroupsForAUserFromOpenLDAP() } [Fact] + [Trait("AuthProvider","OpenLDAP")] internal void ReadsGroupsForAUserFromOpenLDAPWithSpecialCharacters() { // Arrange diff --git a/source/Ldap.Integration.Tests/ISupportsAutoUserCreationFromPrincipalTests.cs b/source/Ldap.Integration.Tests/ISupportsAutoUserCreationFromPrincipalTests.cs index 586ec49..ff90aa0 100644 --- a/source/Ldap.Integration.Tests/ISupportsAutoUserCreationFromPrincipalTests.cs +++ b/source/Ldap.Integration.Tests/ISupportsAutoUserCreationFromPrincipalTests.cs @@ -44,6 +44,7 @@ internal void CreatesAUserFromActiveDirectory() } [Fact] + [Trait("AuthProvider","OpenLDAP")] internal void CreatesAUserFromOpenLDAP() { // Arrange diff --git a/source/Ldap.Integration.Tests/scripts/OpenLdap/docker-compose.yml b/source/Ldap.Integration.Tests/scripts/OpenLdap/docker-compose.yml index 28675ba..d261086 100644 --- a/source/Ldap.Integration.Tests/scripts/OpenLdap/docker-compose.yml +++ b/source/Ldap.Integration.Tests/scripts/OpenLdap/docker-compose.yml @@ -12,7 +12,7 @@ services: LDAP_ADMIN_PASSWORD: ${OCTOPUS_LDAP_OPENLDAP_PASSWORD:-Pass} LDAP_BASE_DN: dc=domain1,dc=local ports: - - 389:389 + - ${OCTOPUS_LDAP_OPENLDAP_PORT:-389}:389 ldap_server_admin: image: osixia/phpldapadmin:0.7.2 From eb930fedc37092379ffbdfd0fd2efc7d1b1c97d5 Mon Sep 17 00:00:00 2001 From: zentron Date: Sat, 9 Apr 2022 23:07:55 +1000 Subject: [PATCH 05/15] Test --- .nuke/build.schema.json | 2 ++ build/Build.cs | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index dee87a0..a321010 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -85,6 +85,7 @@ "Compile", "CopyToLocalPackages", "Default", + "Inegration", "Pack", "Restore", "Test" @@ -105,6 +106,7 @@ "Compile", "CopyToLocalPackages", "Default", + "Inegration", "Pack", "Restore", "Test" diff --git a/build/Build.cs b/build/Build.cs index 9bd27a8..412b6a1 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -1,7 +1,10 @@ +using System; using Nuke.Common; using Nuke.Common.Execution; using Nuke.Common.IO; using Nuke.Common.ProjectModel; +using Nuke.Common.Tooling; +using Nuke.Common.Tools.Docker; using Nuke.Common.Tools.DotNet; using Nuke.Common.Tools.OctoVersion; using Nuke.Common.Utilities.Collections; @@ -122,6 +125,27 @@ class Build : NukeBuild }); }); + const string CONTAINER_PROJECT = "openldap"; + Target Integration => _ => _ + .Executes(() => + { + var composeDirectory = SourceDirectory / "Ldap.Integration.Tests/scripts/OpenLdap/"; + Environment.SetEnvironmentVariable("OCTOPUS_LDAP_OPENLDAP_PORT", "3777"); + + DockerTasks.Docker($"compose -f docker-compose.yml --project-name {CONTAINER_PROJECT} up -d", + composeDirectory); + + DotNetTest(_ => _ + .SetProjectFile(Solution) + .SetConfiguration(Configuration) + .SetFilter("AuthProvider=OpenLDAP") + .SetNoBuild(true) + .EnableNoRestore()); + + DockerTasks.Docker($"compose -f docker-compose.yml --project-name {CONTAINER_PROJECT} down", + composeDirectory); + }); + Target Default => _ => _ .DependsOn(Pack); From 9939f8191cb599b6b04a35fecd1c18469043ded7 Mon Sep 17 00:00:00 2001 From: zentron Date: Mon, 11 Apr 2022 09:56:12 +1000 Subject: [PATCH 06/15] Add Global --- .nuke/build.schema.json | 4 ++-- global.json | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 global.json diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index a321010..a0c9009 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -85,7 +85,7 @@ "Compile", "CopyToLocalPackages", "Default", - "Inegration", + "Integration", "Pack", "Restore", "Test" @@ -106,7 +106,7 @@ "Compile", "CopyToLocalPackages", "Default", - "Inegration", + "Integration", "Pack", "Restore", "Test" diff --git a/global.json b/global.json new file mode 100644 index 0000000..2675d76 --- /dev/null +++ b/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "5.0.100", + "rollForward": "latestFeature", + "allowPrerelease": false + } +} \ No newline at end of file From 60d5bb3de4e6f0094121ad4105bc60913e3c9c75 Mon Sep 17 00:00:00 2001 From: zentron Date: Mon, 11 Apr 2022 10:10:53 +1000 Subject: [PATCH 07/15] Try just invoking scripts --- build/Build.cs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/build/Build.cs b/build/Build.cs index 412b6a1..014f332 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -132,7 +132,25 @@ class Build : NukeBuild var composeDirectory = SourceDirectory / "Ldap.Integration.Tests/scripts/OpenLdap/"; Environment.SetEnvironmentVariable("OCTOPUS_LDAP_OPENLDAP_PORT", "3777"); - DockerTasks.Docker($"compose -f docker-compose.yml --project-name {CONTAINER_PROJECT} up -d", + using (var process = ProcessTasks.StartProcess("powershell", "./New-OpenLdapIntegrationTestEnvironment.ps1", composeDirectory)) + { + process.AssertZeroExitCode(); + } + + DotNetTest(_ => _ + .SetProjectFile(Solution) + .SetConfiguration(Configuration) + .SetFilter("AuthProvider=OpenLDAP") + .SetNoBuild(true) + .EnableNoRestore()); + + using (var process = ProcessTasks.StartProcess("powershell", "./Remove-OpenLdapIntegrationTestEnvironment.ps1", composeDirectory)) + { + process.AssertZeroExitCode(); + } + + + /*DockerTasks.Docker($"compose -f docker-compose.yml --project-name {CONTAINER_PROJECT} up -d", composeDirectory); DotNetTest(_ => _ @@ -142,8 +160,11 @@ class Build : NukeBuild .SetNoBuild(true) .EnableNoRestore()); + var x = ProcessTasks.StartShell("New-OpenLdapIntegrationTestEnvironment.ps1", composeDirectory); + x.WaitForExit(); + DockerTasks.Docker($"compose -f docker-compose.yml --project-name {CONTAINER_PROJECT} down", - composeDirectory); + composeDirectory);*/ }); Target Default => _ => _ From bf04c87c8ede45221e5c95adc6a0a9d9960691eb Mon Sep 17 00:00:00 2001 From: zentron Date: Mon, 11 Apr 2022 10:14:50 +1000 Subject: [PATCH 08/15] use pwsh --- build/Build.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/Build.cs b/build/Build.cs index 014f332..5027714 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -132,7 +132,7 @@ class Build : NukeBuild var composeDirectory = SourceDirectory / "Ldap.Integration.Tests/scripts/OpenLdap/"; Environment.SetEnvironmentVariable("OCTOPUS_LDAP_OPENLDAP_PORT", "3777"); - using (var process = ProcessTasks.StartProcess("powershell", "./New-OpenLdapIntegrationTestEnvironment.ps1", composeDirectory)) + using (var process = ProcessTasks.StartProcess("pwsh", "./New-OpenLdapIntegrationTestEnvironment.ps1", composeDirectory)) { process.AssertZeroExitCode(); } @@ -144,7 +144,7 @@ class Build : NukeBuild .SetNoBuild(true) .EnableNoRestore()); - using (var process = ProcessTasks.StartProcess("powershell", "./Remove-OpenLdapIntegrationTestEnvironment.ps1", composeDirectory)) + using (var process = ProcessTasks.StartProcess("pwsh", "./Remove-OpenLdapIntegrationTestEnvironment.ps1", composeDirectory)) { process.AssertZeroExitCode(); } From 9fa5721636919da4ce1fb64dfb8dfdf8bdaa4010 Mon Sep 17 00:00:00 2001 From: zentron Date: Mon, 11 Apr 2022 10:16:48 +1000 Subject: [PATCH 09/15] allow build before testing --- build/Build.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build/Build.cs b/build/Build.cs index 5027714..fc66b8d 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -140,9 +140,7 @@ class Build : NukeBuild DotNetTest(_ => _ .SetProjectFile(Solution) .SetConfiguration(Configuration) - .SetFilter("AuthProvider=OpenLDAP") - .SetNoBuild(true) - .EnableNoRestore()); + .SetFilter("AuthProvider=OpenLDAP")); using (var process = ProcessTasks.StartProcess("pwsh", "./Remove-OpenLdapIntegrationTestEnvironment.ps1", composeDirectory)) { From edd53e66e0daa40709fda0796bc8c149dd6f1f7d Mon Sep 17 00:00:00 2001 From: zentron Date: Mon, 11 Apr 2022 10:18:22 +1000 Subject: [PATCH 10/15] Add TC logger --- build/Build.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/Build.cs b/build/Build.cs index fc66b8d..52878b8 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -1,5 +1,6 @@ using System; using Nuke.Common; +using Nuke.Common.CI.TeamCity; using Nuke.Common.Execution; using Nuke.Common.IO; using Nuke.Common.ProjectModel; @@ -140,6 +141,7 @@ class Build : NukeBuild DotNetTest(_ => _ .SetProjectFile(Solution) .SetConfiguration(Configuration) + .AddTeamCityLogger() .SetFilter("AuthProvider=OpenLDAP")); using (var process = ProcessTasks.StartProcess("pwsh", "./Remove-OpenLdapIntegrationTestEnvironment.ps1", composeDirectory)) From 173435f7d3ef98b6a562ccb62c8154582b528011 Mon Sep 17 00:00:00 2001 From: zentron Date: Mon, 11 Apr 2022 10:21:02 +1000 Subject: [PATCH 11/15] Add TC logger --- build/Build.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build/Build.cs b/build/Build.cs index 52878b8..3606d62 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -141,8 +141,12 @@ class Build : NukeBuild DotNetTest(_ => _ .SetProjectFile(Solution) .SetConfiguration(Configuration) - .AddTeamCityLogger() - .SetFilter("AuthProvider=OpenLDAP")); + .SetFilter("AuthProvider=OpenLDAP") + .SetProcessArgumentConfigurator(arguments => arguments + .Add("--logger trx") + .Add("--logger console;verbosity=normal") + .Add(TeamCity.Instance is not null ? "--logger teamcity" : string.Empty) + )); using (var process = ProcessTasks.StartProcess("pwsh", "./Remove-OpenLdapIntegrationTestEnvironment.ps1", composeDirectory)) { From dcebb99d1add8e7b77bd0b546913391056e2e839 Mon Sep 17 00:00:00 2001 From: zentron Date: Mon, 11 Apr 2022 14:40:52 +1000 Subject: [PATCH 12/15] Add TC assembly --- build/Build.cs | 34 ++++++++++--------- .../Ldap.Integration.Tests.csproj | 1 + 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/build/Build.cs b/build/Build.cs index 3606d62..76e2880 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -126,34 +126,36 @@ class Build : NukeBuild }); }); - const string CONTAINER_PROJECT = "openldap"; Target Integration => _ => _ .Executes(() => { var composeDirectory = SourceDirectory / "Ldap.Integration.Tests/scripts/OpenLdap/"; Environment.SetEnvironmentVariable("OCTOPUS_LDAP_OPENLDAP_PORT", "3777"); - using (var process = ProcessTasks.StartProcess("pwsh", "./New-OpenLdapIntegrationTestEnvironment.ps1", composeDirectory)) + using (var process = ProcessTasks.StartProcess("powershell", "./New-OpenLdapIntegrationTestEnvironment.ps1", composeDirectory)) { process.AssertZeroExitCode(); } - - DotNetTest(_ => _ - .SetProjectFile(Solution) - .SetConfiguration(Configuration) - .SetFilter("AuthProvider=OpenLDAP") - .SetProcessArgumentConfigurator(arguments => arguments - .Add("--logger trx") - .Add("--logger console;verbosity=normal") - .Add(TeamCity.Instance is not null ? "--logger teamcity" : string.Empty) - )); - - using (var process = ProcessTasks.StartProcess("pwsh", "./Remove-OpenLdapIntegrationTestEnvironment.ps1", composeDirectory)) + + try { + DotNetTest(_ => _ + .SetProjectFile(Solution) + .SetConfiguration(Configuration) + .SetFilter("AuthProvider=OpenLDAP") + .SetProcessArgumentConfigurator(arguments => arguments + .Add("--logger trx") + .Add("--logger console;verbosity=normal") + .Add(TeamCity.Instance is not null ? "--logger teamcity" : string.Empty) + )); + } + finally + { + using var process = ProcessTasks.StartProcess("powershell", "./Remove-OpenLdapIntegrationTestEnvironment.ps1", composeDirectory); process.AssertZeroExitCode(); } - - + + /*DockerTasks.Docker($"compose -f docker-compose.yml --project-name {CONTAINER_PROJECT} up -d", composeDirectory); diff --git a/source/Ldap.Integration.Tests/Ldap.Integration.Tests.csproj b/source/Ldap.Integration.Tests/Ldap.Integration.Tests.csproj index 1aeff8f..d3dfff4 100644 --- a/source/Ldap.Integration.Tests/Ldap.Integration.Tests.csproj +++ b/source/Ldap.Integration.Tests/Ldap.Integration.Tests.csproj @@ -9,6 +9,7 @@ + runtime; build; native; contentfiles; analyzers; buildtransitive From 4453ce805ad7dffa1e98e7e2d064a2652412c6df Mon Sep 17 00:00:00 2001 From: zentron Date: Mon, 11 Apr 2022 14:47:19 +1000 Subject: [PATCH 13/15] Back to pwsh --- build/Build.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/Build.cs b/build/Build.cs index 76e2880..dc92889 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -132,7 +132,7 @@ class Build : NukeBuild var composeDirectory = SourceDirectory / "Ldap.Integration.Tests/scripts/OpenLdap/"; Environment.SetEnvironmentVariable("OCTOPUS_LDAP_OPENLDAP_PORT", "3777"); - using (var process = ProcessTasks.StartProcess("powershell", "./New-OpenLdapIntegrationTestEnvironment.ps1", composeDirectory)) + using (var process = ProcessTasks.StartProcess("pwsh", "./New-OpenLdapIntegrationTestEnvironment.ps1", composeDirectory)) { process.AssertZeroExitCode(); } @@ -151,7 +151,7 @@ class Build : NukeBuild } finally { - using var process = ProcessTasks.StartProcess("powershell", "./Remove-OpenLdapIntegrationTestEnvironment.ps1", composeDirectory); + using var process = ProcessTasks.StartProcess("pwsh", "./Remove-OpenLdapIntegrationTestEnvironment.ps1", composeDirectory); process.AssertZeroExitCode(); } From 5c3c19148eda2701134bfa671d8d5be21e642117 Mon Sep 17 00:00:00 2001 From: zentron Date: Mon, 11 Apr 2022 22:25:24 +1000 Subject: [PATCH 14/15] Add test setup for AD --- .nuke/build.schema.json | 2 + build/Build.cs | 68 ++++++++++++++++++- .../ICanMatchExternalUserTests.cs | 1 + .../ICanSearchExternalGroupsTests.cs | 1 + .../ICanSearchExternalUsersTests.cs | 1 + .../IDoesBasicAuthenticationTests.cs | 1 + .../IExternalGroupRetrieverTests.cs | 2 + ...portsAutoUserCreationFromPrincipalTests.cs | 1 + 8 files changed, 76 insertions(+), 1 deletion(-) diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index a0c9009..7ee2355 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -86,6 +86,7 @@ "CopyToLocalPackages", "Default", "Integration", + "Integration2", "Pack", "Restore", "Test" @@ -107,6 +108,7 @@ "CopyToLocalPackages", "Default", "Integration", + "Integration2", "Pack", "Restore", "Test" diff --git a/build/Build.cs b/build/Build.cs index dc92889..8913d28 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -1,4 +1,7 @@ using System; +using System.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using Nuke.Common; using Nuke.Common.CI.TeamCity; using Nuke.Common.Execution; @@ -126,7 +129,8 @@ class Build : NukeBuild }); }); - Target Integration => _ => _ + + Target Integration2 => _ => _ .Executes(() => { var composeDirectory = SourceDirectory / "Ldap.Integration.Tests/scripts/OpenLdap/"; @@ -156,6 +160,68 @@ class Build : NukeBuild } + /*DockerTasks.Docker($"compose -f docker-compose.yml --project-name {CONTAINER_PROJECT} up -d", + composeDirectory); + + DotNetTest(_ => _ + .SetProjectFile(Solution) + .SetConfiguration(Configuration) + .SetFilter("AuthProvider=OpenLDAP") + .SetNoBuild(true) + .EnableNoRestore()); + + var x = ProcessTasks.StartShell("New-OpenLdapIntegrationTestEnvironment.ps1", composeDirectory); + x.WaitForExit(); + + DockerTasks.Docker($"compose -f docker-compose.yml --project-name {CONTAINER_PROJECT} down", + composeDirectory);*/ + }); + + Target Integration => _ => _ + .Executes(() => + { + var composeDirectory = SourceDirectory / "Ldap.Integration.Tests/scripts/ActiveDirectory/Azure/"; + + string public_ip_addr, admin_password; + + + using (var process = ProcessTasks.StartProcess("powershell", "./New-ActiveDirectoryIntegrationTestEnvironment.ps1", composeDirectory)) + { + process.AssertZeroExitCode(); + } + + using (var process = ProcessTasks.StartProcess("terraform", "output -json", composeDirectory)) + { + process.AssertZeroExitCode(); + var rawJson = process.Output.Where(d => d.Type == OutputType.Std) + .Select(d => d.Text) + .Aggregate(string.Empty, (a, b) => $"{a}{Environment.NewLine}{b}"); + var raw = JsonConvert.DeserializeObject(rawJson); + + public_ip_addr = raw["public_ip_addr"].Value("value"); + admin_password = raw["admin_password"].Value("value"); + } + + try + { + DotNetTest(_ => _ + .SetProjectFile(Solution) + .SetConfiguration(Configuration) + .SetFilter("AuthProvider=ActiveDirectory") + .SetProcessEnvironmentVariable("OCTOPUS_LDAP_AD_SERVER", public_ip_addr) + .SetProcessEnvironmentVariable("OCTOPUS_LDAP_AD_PASSWORD", admin_password) + .SetProcessArgumentConfigurator(arguments => arguments + .Add("--logger trx") + .Add("--logger console;verbosity=normal") + )); + } + finally + { + using var process = ProcessTasks.StartProcess("powershell", "./Remove-ActiveDirectoryIntegrationTestEnvironment.ps1", composeDirectory); + process.AssertZeroExitCode(); + } + + /*DockerTasks.Docker($"compose -f docker-compose.yml --project-name {CONTAINER_PROJECT} up -d", composeDirectory); diff --git a/source/Ldap.Integration.Tests/ICanMatchExternalUserTests.cs b/source/Ldap.Integration.Tests/ICanMatchExternalUserTests.cs index 9fd6472..dde46ef 100644 --- a/source/Ldap.Integration.Tests/ICanMatchExternalUserTests.cs +++ b/source/Ldap.Integration.Tests/ICanMatchExternalUserTests.cs @@ -17,6 +17,7 @@ public TheMatchMethod(ITestOutputHelper testLogger) } [Fact] + [Trait("AuthProvider","ActiveDirectory")] internal void MatchesAUserFromActiveDirectory() { var userName = "developer1"; diff --git a/source/Ldap.Integration.Tests/ICanSearchExternalGroupsTests.cs b/source/Ldap.Integration.Tests/ICanSearchExternalGroupsTests.cs index 09ed2ee..1efe048 100644 --- a/source/Ldap.Integration.Tests/ICanSearchExternalGroupsTests.cs +++ b/source/Ldap.Integration.Tests/ICanSearchExternalGroupsTests.cs @@ -19,6 +19,7 @@ public TheSearchMethod(ITestOutputHelper testLogger) } [Fact] + [Trait("AuthProvider","ActiveDirectory")] internal void FindsGroupsFromActiveDirectory() { var partialName = "Devel"; diff --git a/source/Ldap.Integration.Tests/ICanSearchExternalUsersTests.cs b/source/Ldap.Integration.Tests/ICanSearchExternalUsersTests.cs index 865e9a8..54d43a1 100644 --- a/source/Ldap.Integration.Tests/ICanSearchExternalUsersTests.cs +++ b/source/Ldap.Integration.Tests/ICanSearchExternalUsersTests.cs @@ -18,6 +18,7 @@ public TheSearchMethod(ITestOutputHelper testLogger) } [Fact] + [Trait("AuthProvider","ActiveDirectory")] internal void FindsUsersFromActiveDirectory() { var partialName = "devel"; diff --git a/source/Ldap.Integration.Tests/IDoesBasicAuthenticationTests.cs b/source/Ldap.Integration.Tests/IDoesBasicAuthenticationTests.cs index 097665c..5b5507c 100644 --- a/source/Ldap.Integration.Tests/IDoesBasicAuthenticationTests.cs +++ b/source/Ldap.Integration.Tests/IDoesBasicAuthenticationTests.cs @@ -20,6 +20,7 @@ public TheValidateCredentialsMethod(ITestOutputHelper testLogger) } [Fact] + [Trait("AuthProvider","ActiveDirectory")] internal void ValidatesAUserFromActiveDirectory() { // Arrange diff --git a/source/Ldap.Integration.Tests/IExternalGroupRetrieverTests.cs b/source/Ldap.Integration.Tests/IExternalGroupRetrieverTests.cs index 40e9548..166a0d2 100644 --- a/source/Ldap.Integration.Tests/IExternalGroupRetrieverTests.cs +++ b/source/Ldap.Integration.Tests/IExternalGroupRetrieverTests.cs @@ -19,6 +19,7 @@ public TheReadMethod(ITestOutputHelper testLogger) } [Fact] + [Trait("AuthProvider","ActiveDirectory")] internal void ReadsGroupsForAUserFromActiveDirectory() { // Arrange @@ -48,6 +49,7 @@ internal void ReadsGroupsForAUserFromActiveDirectory() } [Fact] + [Trait("AuthProvider","ActiveDirectory")] internal void ReadsGroupsForAUserFromActiveDirectoryWithSpecialCharacters() { // Arrange diff --git a/source/Ldap.Integration.Tests/ISupportsAutoUserCreationFromPrincipalTests.cs b/source/Ldap.Integration.Tests/ISupportsAutoUserCreationFromPrincipalTests.cs index ff90aa0..66aeaba 100644 --- a/source/Ldap.Integration.Tests/ISupportsAutoUserCreationFromPrincipalTests.cs +++ b/source/Ldap.Integration.Tests/ISupportsAutoUserCreationFromPrincipalTests.cs @@ -20,6 +20,7 @@ public TheGetOrCreateUserMethod(ITestOutputHelper testLogger) } [Fact] + [Trait("AuthProvider","ActiveDirectory")] internal void CreatesAUserFromActiveDirectory() { // Arrange From abfef75ac80ad02113bb33baf7404f0073de727d Mon Sep 17 00:00:00 2001 From: zentron Date: Mon, 11 Apr 2022 22:26:15 +1000 Subject: [PATCH 15/15] use pwsh --- build/Build.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/Build.cs b/build/Build.cs index 8913d28..fee82fe 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -185,7 +185,7 @@ class Build : NukeBuild string public_ip_addr, admin_password; - using (var process = ProcessTasks.StartProcess("powershell", "./New-ActiveDirectoryIntegrationTestEnvironment.ps1", composeDirectory)) + using (var process = ProcessTasks.StartProcess("pwsh", "./New-ActiveDirectoryIntegrationTestEnvironment.ps1", composeDirectory)) { process.AssertZeroExitCode(); } @@ -217,7 +217,7 @@ class Build : NukeBuild } finally { - using var process = ProcessTasks.StartProcess("powershell", "./Remove-ActiveDirectoryIntegrationTestEnvironment.ps1", composeDirectory); + using var process = ProcessTasks.StartProcess("pwsh", "./Remove-ActiveDirectoryIntegrationTestEnvironment.ps1", composeDirectory); process.AssertZeroExitCode(); }