Skip to content

Commit d85ad8f

Browse files
committed
add test
1 parent 92767bf commit d85ad8f

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

.gitlab/e2e_install_packages/windows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,5 +249,6 @@ new-e2e-installer-windows:
249249
- EXTRA_PARAMS: --run "TestAgentMSIInstallsDotnetLibrary/TestMSISkipRollbackIfInstalled$"
250250
- EXTRA_PARAMS: --run "TestAgentMSIInstallsDotnetLibrary/TestUninstallKeepsLibrary$"
251251
- EXTRA_PARAMS: --run "TestAgentMSIInstallsDotnetLibrary/TestUninstallScript$"
252+
- EXTRA_PARAMS: --run "TestAgentMSIInstallsDotnetLibrary/TestMSIPurge$"
252253
- EXTRA_PARAMS: --run "TestAgentScriptInstallsDotnetLibrary/TestInstallFromScript$"
253254
- EXTRA_PARAMS: --run "TestAgentScriptInstallsDotnetLibrary/TestScriptThenRemoteUpgrade$"

test/new-e2e/tests/installer/windows/suites/apm-library-dotnet-package/msi_install_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,44 @@ func (s *testAgentMSIInstallsDotnetLibrary) TestUninstallScript() {
297297
s.Require().Empty(newLibraryPath)
298298
}
299299

300+
// TestUninstallScript validates that instrumentation is disabled after we run the uninstall script
301+
func (s *testAgentMSIInstallsDotnetLibrary) TestMSIPurge() {
302+
// Arrange
303+
version := s.currentDotnetLibraryVersion
304+
305+
// Act
306+
s.installCurrentAgentVersion(
307+
installerwindows.WithMSIArg("DD_APM_INSTRUMENTATION_ENABLED=iis"),
308+
// TODO: remove override once image is published in prod
309+
installerwindows.WithMSIArg("DD_INSTALLER_REGISTRY_URL=install.datad0g.com.internal.dda-testing.com"),
310+
installerwindows.WithMSIArg(fmt.Sprintf("DD_APM_INSTRUMENTATION_LIBRARIES=dotnet:%s", version.PackageVersion())),
311+
installerwindows.WithMSILogFile("install.log"),
312+
)
313+
// Start the IIS app to load the library
314+
defer s.stopIISApp()
315+
s.startIISApp(webConfigFile, aspxFile)
316+
317+
// Assert
318+
s.assertSuccessfulPromoteExperiment(version.Version())
319+
// Check that the expected version of the library is loaded
320+
oldLibraryPath := s.getLibraryPathFromInstrumentedIIS()
321+
s.Require().Contains(oldLibraryPath, version.Version())
322+
323+
// uninstall the MSI with PURGE=1
324+
options := []installerwindows.MsiOption{
325+
installerwindows.WithMSILogFile("uninstall.log"),
326+
installerwindows.WithMSIArg("PURGE=1"),
327+
}
328+
s.Require().NoError(s.Installer().Uninstall(options...))
329+
330+
// verify it is uninstalled
331+
s.stopIISApp()
332+
defer s.stopIISApp()
333+
s.startIISApp(webConfigFile, aspxFile)
334+
newLibraryPath := s.getLibraryPathFromInstrumentedIIS()
335+
s.Require().Empty(newLibraryPath)
336+
}
337+
300338
func (s *testAgentMSIInstallsDotnetLibrary) installPreviousAgentVersion(opts ...installerwindows.MsiOption) {
301339
agentVersion := s.StableAgentVersion().Version()
302340
options := []installerwindows.MsiOption{

0 commit comments

Comments
 (0)