@@ -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+
300338func (s * testAgentMSIInstallsDotnetLibrary ) installPreviousAgentVersion (opts ... installerwindows.MsiOption ) {
301339 agentVersion := s .StableAgentVersion ().Version ()
302340 options := []installerwindows.MsiOption {
0 commit comments