diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 34bd7f51..5fb98f26 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -102,8 +102,8 @@ jobs: echo `docker exec -i --workdir /home/irisowner/zpm/ $CONTAINER ls -rtl` /bin/echo -e '' \ 'zpm "list":1\n' \ - 'zpm "test zpm -v -only"\n' \ - 'zpm "verify zpm -v -only"\n' \ + 'zpm "test zpm -v -only":1\n' \ + 'zpm "verify zpm -v -only":1\n' \ 'halt\n' \ | docker exec -i $CONTAINER iris session iris -UUSER docker stop $CONTAINER diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index e3d67afc..1e8ece03 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -100,6 +100,7 @@ jobs: -DUnitTest.FailuresAreFatal=1 -DUnitTest.Manager=%UnitTest.Manager run: | docker exec -i ${{ env.CONTAINER }} iris session IRIS << EOF + zpm "config set analytics 0":1 zpm "install ${{ matrix.package }}":1 zpm "${{ matrix.package }} test -only ${{ env.test-flags }}":1:1 EOF diff --git a/CHANGELOG.md b/CHANGELOG.md index 659f3bda..7cf79578 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - HSIEO-10267: Bug Fix - Resource name should be the fifth argument of CreateDatabase - #440: IPM works with delimited identifiers disabled - #451: (CI) Run on fewer versions to minimize overhead and Community Edition expiration issues +- #451, #428: Fixes "Verify" phase to work properly after %IPM rename - #451: Avoid compliation errors due to storage location conflict on IRIS for Health prior to 2024.1 - #455: Upgrade from %ZPM classes updates language extensions correctly to use %IPM - #373: Cleaner cross-version approach used in language extension routine generation diff --git a/Dockerfile b/Dockerfile index 95d397a0..25d1ffc5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG BASE=containers.intersystems.com/intersystems/irishealth-community:2023.1.0.229.0 +ARG BASE=containers.intersystems.com/intersystems/irishealth-community:2024.1 FROM ${BASE} ARG REGISTRY=https://pm.community.intersystems.com diff --git a/src/cls/IPM/ResourceProcessor/Default/Document.cls b/src/cls/IPM/ResourceProcessor/Default/Document.cls index 332e8a2c..213703d5 100644 --- a/src/cls/IPM/ResourceProcessor/Default/Document.cls +++ b/src/cls/IPM/ResourceProcessor/Default/Document.cls @@ -123,9 +123,17 @@ Method OnPhase(pPhase As %String, ByRef pParams, Output pResourceHandled As %Boo } If '..ResourceReference.Preload { - Set tFileExtension = $Select(..LoadAsDirectory:"",1:"."_..FilenameExtension) - Set tResourcePath = ##class(%File).NormalizeFilename(tResourceDirectory _ tSubDirectory _ $Translate(tName, ..FilenameTranslateIdentifier, ..FilenameTranslateAssociator)) _ tFileExtension - If '..LoadAsDirectory { + Set tFileExtension = "" + Set tResourcePath = ##class(%File).NormalizeFilename(tResourceDirectory _ tSubDirectory _ $Translate(tName, ..FilenameTranslateIdentifier, ..FilenameTranslateAssociator)) + If '..LoadAsDirectory { + Set tItemFileExtension = $$$lcase("." _ $Piece(..ResourceReference.Name, ".", *)) + Set tFileExtension = $$$lcase("." _ ..FilenameExtension) + For tFileExtension = tFileExtension,tItemFileExtension { + Quit:##class(%IPM.Utils.File).Exists(tResourcePath _ tFileExtension) + } + + Set tResourcePath = tResourcePath _ tFileExtension + If ($$$lcase(tFileExtension)'=".xml")&&('##class(%File).Exists(tResourcePath)) { Set tResourcePathXML = tResourcePath Set $PIECE(tResourcePath, ".", *) = "xml" @@ -394,7 +402,7 @@ Method OnLoad(pFullResourcePath As %String, pVerbose As %Boolean, pCompile As %B } Else { Set tProcessed = 0 set fileExt = $$$UPPER($Piece(pFullResourcePath, ".", *)) - if '$LISTFIND($LB("CLS", "MAC", "XML"), fileExt), ##class(%RoutineMgr).UserType(..ResourceReference.Name, .docclass, .doctype) { + if '$LISTFIND($LB("CLS", "MAC"), fileExt), ##class(%RoutineMgr).UserType(..ResourceReference.Name, .docclass, .doctype) { try { set stream = ##class(%Stream.FileCharacter).%New() $$$ThrowOnError(stream.LinkToFile(pFullResourcePath)) diff --git a/src/cls/IPM/Test/Utils.cls b/src/cls/IPM/Test/Utils.cls index ebb0458d..08968dd1 100644 --- a/src/cls/IPM/Test/Utils.cls +++ b/src/cls/IPM/Test/Utils.cls @@ -8,6 +8,7 @@ ClassMethod CreateNamespace(pNSName As %String) As %Status New $Namespace Set tSC = $$$OK Try { + Set oldNamespace = $Namespace Set $Namespace = "%SYS" Set tLowerName = $ZCVT(pNSName,"L") @@ -51,10 +52,10 @@ ClassMethod CreateNamespace(pNSName As %String) As %Status Set tNSProps("Globals") = pNSName Set tNSProps("Routines") = pNSName - Set tNSProps("Library") = "IRISLIB" - Set tNSProps("SysGlobals") = "IRISSYS" - Set tNSProps("SysRoutines") = "IRISSYS" - Set tNSProps("TempGlobals") = "IRISTEMP" + Set tNSProps("Library") = "IRISLIB" + Set tNSProps("SysGlobals") = "IRISSYS" + Set tNSProps("SysRoutines") = "IRISSYS" + Set tNSProps("TempGlobals") = "IRISTEMP" Set tSC = ##class(Config.Namespaces).Create(pNSName,.tNSProps) If $$$ISERR(tSC) { @@ -80,6 +81,9 @@ ClassMethod CreateNamespace(pNSName As %String) As %Status If $$$ISERR(tSC) { Quit } + + Set $Namespace = oldNamespace + $$$ThrowOnError(##class(%IPM.Utils.Build).MapPackageEquivalently("%IPM",oldNamespace,pNSName)) } Catch e { Set tSC = e.AsStatus() } @@ -89,6 +93,7 @@ ClassMethod CreateNamespace(pNSName As %String) As %Status ClassMethod DeleteNamespace(pNSName As %String) As %Status { New $Namespace + Set oldNamespace = $Namespace Set tFinalStatus = $$$OK Try { Set $Namespace = "%SYS" @@ -138,6 +143,7 @@ ClassMethod DeleteNamespace(pNSName As %String) As %Status Set tFinalStatus = $$$ADDSC(tFinalStatus,tSC) // Delete directories + Set $Namespace = oldNamespace Set tDirRemoved = ##class(%IPM.Utils.File).RemoveDirectoryTree(tPath) If 'tDirRemoved { Set tFinalStatus = $$$ADDSC(tFinalStatus,$$$ERROR($$$GeneralError,"Error removing directory '"_tPath_"'")) diff --git a/src/cls/IPM/Utils/Build.cls b/src/cls/IPM/Utils/Build.cls index c8d92969..d5bbbff0 100644 --- a/src/cls/IPM/Utils/Build.cls +++ b/src/cls/IPM/Utils/Build.cls @@ -507,6 +507,7 @@ ClassMethod MapPackageEquivalently(pPackageName As %String, pSourceNamespace As Set tSC = $$$OK Try { New $Namespace + Set oldNamespace = $Namespace Set tSourceDB = ##class(%SYS.Namespace).GetPackageDest(pSourceNamespace,pPackageName) Set $Namespace = "%SYS" // In tSourceDB: @@ -520,6 +521,7 @@ ClassMethod MapPackageEquivalently(pPackageName As %String, pSourceNamespace As $$$ThrowStatus($$$ERROR($$$GeneralError,$$$FormatText("Could not find database name for '%1'",tDBDir))) } $$$ThrowOnError(tSC) + Set $Namespace = oldNamespace Set tSC = ##class(%IPM.Utils.Module).AddPackageMapping(pMappedToNamespace, pPackageName, $ListGet(tDBList)) $$$ThrowOnError(tSC) } Catch e { @@ -534,6 +536,7 @@ ClassMethod MapRoutineEquivalently(pRoutineName As %String, pSourceNamespace As Set tSC = $$$OK Try { New $Namespace + Set oldNamespace = $Namespace Set tSourceDB = ##class(%SYS.Namespace).GetRoutineDest(pSourceNamespace,pRoutineName,pType) Set $Namespace = "%SYS" // In tSourceDB: @@ -547,6 +550,7 @@ ClassMethod MapRoutineEquivalently(pRoutineName As %String, pSourceNamespace As $$$ThrowStatus($$$ERROR($$$GeneralError,$$$FormatText("Could not find database name for '%1'",tDBDir))) } $$$ThrowOnError(tSC) + Set $Namespace = oldNamespace Set tSC = ##class(%IPM.Utils.Module).AddRoutineMapping(pMappedToNamespace, pRoutineName, pType, $ListGet(tDBList)) $$$ThrowOnError(tSC) } Catch e { @@ -561,6 +565,7 @@ ClassMethod MapGlobalEquivalently(pGlobalName As %String, pSourceNamespace As %S Set tSC = $$$OK Try { New $Namespace + Set oldNamespace = $Namespace Set tSourceDB = ##class(%SYS.Namespace).GetGlobalDest(pSourceNamespace,pGlobalName) Set $Namespace = "%SYS" // In tSourceDB: @@ -574,6 +579,7 @@ ClassMethod MapGlobalEquivalently(pGlobalName As %String, pSourceNamespace As %S $$$ThrowStatus($$$ERROR($$$GeneralError,$$$FormatText("Could not find database name for '%1'",tDBDir))) } $$$ThrowOnError(tSC) + Set $Namespace = oldNamespace Set tSC = ##class(%IPM.Utils.Module).AddGlobalMapping(pMappedToNamespace, pGlobalName, $ListGet(tDBList)) $$$ThrowOnError(tSC) } Catch e { diff --git a/tests/integration_tests/Test/PM/Integration/Base.cls b/tests/integration_tests/Test/PM/Integration/Base.cls index 818888e4..bce773de 100644 --- a/tests/integration_tests/Test/PM/Integration/Base.cls +++ b/tests/integration_tests/Test/PM/Integration/Base.cls @@ -5,6 +5,8 @@ Parameter REGISTRYNAME = "test_registry"; Parameter CLIENTNS As STRING = "UTCLIENT"; +Parameter NEEDSREGISTRY As BOOLEAN = 1; + Property UserCreated As %Boolean [ InitialExpression = 0 ]; Property ClientNSCreated As %Boolean [ InitialExpression = 0 ]; @@ -25,28 +27,31 @@ Method Setup() As %Status Set ..ClientNSCreated = 1 // Client namespace setup - Set $Namespace = ..#CLIENTNS - - if ($system.Util.GetEnviron("TEST_REGISTRY")="") { - Do $$$AssertFailure("Registry Server not defined") - Quit - } - if ('..RegistryAdded) { - Set tServerDefn = ##class(%IPM.Repo.Remote.Definition).%New() - Set tServerDefn.Name = ..#REGISTRYNAME - Set tServerDefn.Enabled = 1 - Set tServerDefn.URL = $system.Util.GetEnviron("TEST_REGISTRY") - Set tServerDefn.DeploymentEnabled = 1 - Set tServerDefn.Username = $system.Util.GetEnviron("TEST_REGISTRY_USER") - Set tServerDefn.Password = $system.Util.GetEnviron("TEST_REGISTRY_PASSWORD") - Set tServerDefn.Prereleases = 1 - Set tServerDefn.Snapshots = 1 - Do $$$AssertStatusOK(tServerDefn.%Save(),"Remote server definition saved.") - - Set ..RegistryAdded = 1 + if ..#NEEDSREGISTRY { + if ($system.Util.GetEnviron("TEST_REGISTRY")="") { + Do $$$AssertSkipped("Registry Server not defined") + Quit + } + if ('..RegistryAdded) { + for namespace = $Namespace,..#CLIENTNS { + set $Namespace = namespace + Set tServerDefn = ##class(%IPM.Repo.Remote.Definition).%New() + Set tServerDefn.Name = ..#REGISTRYNAME + Set tServerDefn.Enabled = 1 + Set tServerDefn.URL = $system.Util.GetEnviron("TEST_REGISTRY") + Set tServerDefn.DeploymentEnabled = 1 + Set tServerDefn.Username = $system.Util.GetEnviron("TEST_REGISTRY_USER") + Set tServerDefn.Password = $system.Util.GetEnviron("TEST_REGISTRY_PASSWORD") + Set tServerDefn.Prereleases = 1 + Set tServerDefn.Snapshots = 1 + Do $$$AssertStatusOK(tServerDefn.%Save(),"Remote server definition saved.") + + Set ..RegistryAdded = 1 - /// Clear any packages on remote registry for debug purposes - Do tServerDefn.GetPackageService().ResetRegistry() + /// Clear any packages on remote registry for debug purposes + Do tServerDefn.GetPackageService().ResetRegistry() + } + } } } Catch e { Set tSC = e.AsStatus() diff --git a/tests/integration_tests/Test/PM/Integration/ClientServer.cls b/tests/integration_tests/Test/PM/Integration/ClientServer.cls index 8a1d63fb..7fb12382 100644 --- a/tests/integration_tests/Test/PM/Integration/ClientServer.cls +++ b/tests/integration_tests/Test/PM/Integration/ClientServer.cls @@ -8,7 +8,7 @@ Method TestEverything() New $Namespace Set tOrigNS = $Namespace Try { - If '$$$AssertStatusOK(..Setup()) { + If '$$$AssertStatusOK(..Setup()) || ..SkipTest { Quit } diff --git a/tests/integration_tests/Test/PM/Integration/DependencyResolution.cls b/tests/integration_tests/Test/PM/Integration/DependencyResolution.cls index 16788ab9..825024e4 100644 --- a/tests/integration_tests/Test/PM/Integration/DependencyResolution.cls +++ b/tests/integration_tests/Test/PM/Integration/DependencyResolution.cls @@ -7,7 +7,7 @@ Method TestEverything() New $Namespace Set tOrigNS = $Namespace Try { - If '$$$AssertStatusOK(..Setup()) { + If '$$$AssertStatusOK(..Setup()) || ..SkipTest { Quit } diff --git a/tests/integration_tests/Test/PM/Integration/Resources.cls b/tests/integration_tests/Test/PM/Integration/Resources.cls index 2f7e3fd1..f6d4ae4f 100644 --- a/tests/integration_tests/Test/PM/Integration/Resources.cls +++ b/tests/integration_tests/Test/PM/Integration/Resources.cls @@ -1,15 +1,26 @@ -Class Test.PM.Integration.Resources Extends %UnitTest.TestCase +Class Test.PM.Integration.Resources Extends Test.PM.Integration.Base { +Parameter NEEDSREGISTRY = 0; + Method TestResourceTypes() { - If ('$ListFind($system.Version.GetISCComponents(), "Health")) { - Quit $$$OK - } + New $Namespace + Set oldNamespace = $Namespace + + If ('$ListFind($system.Version.GetISCComponents(), "Health")) { + Do $$$AssertSkipped("This test only runs on IRIS for Health, which has all resource types available.") + Quit $$$OK + } Set tSC = $$$OK Try { Set tTestRoot = $Get(^UnitTestRoot) + + If '$$$AssertStatusOK(..Setup()) { + Quit + } + Set $Namespace = ..#CLIENTNS // Uninstall. This might fail; if it does that's fine. Do ##class(%IPM.Storage.Module).Uninstall("ResourceTest",1,1) @@ -37,6 +48,9 @@ Method TestResourceTypes() } Catch e { Do $$$AssertStatusOK(e.AsStatus(),"An exception occurred.") } + + Set $Namespace = oldNamespace + Do ..TearDown() } } diff --git a/tests/integration_tests/Test/PM/Integration/_data/resource-test/misc/2_1_vscode.HL7 b/tests/integration_tests/Test/PM/Integration/_data/resource-test/misc/2_1_vscode.hl7 similarity index 100% rename from tests/integration_tests/Test/PM/Integration/_data/resource-test/misc/2_1_vscode.HL7 rename to tests/integration_tests/Test/PM/Integration/_data/resource-test/misc/2_1_vscode.hl7 diff --git a/tests/integration_tests/Test/PM/Integration/_data/resource-test/misc/Test_HIPAA_5010_vscode.X12 b/tests/integration_tests/Test/PM/Integration/_data/resource-test/misc/Test_HIPAA_5010_vscode.x12 similarity index 100% rename from tests/integration_tests/Test/PM/Integration/_data/resource-test/misc/Test_HIPAA_5010_vscode.X12 rename to tests/integration_tests/Test/PM/Integration/_data/resource-test/misc/Test_HIPAA_5010_vscode.x12 diff --git a/tests/integration_tests/Test/PM/Integration/_data/simple-app/module.xml b/tests/integration_tests/Test/PM/Integration/_data/simple-app/module.xml index da0e8ee7..328d00f9 100644 --- a/tests/integration_tests/Test/PM/Integration/_data/simple-app/module.xml +++ b/tests/integration_tests/Test/PM/Integration/_data/simple-app/module.xml @@ -10,6 +10,8 @@ + + diff --git a/tests/integration_tests/Test/PM/Integration/_data/simple-app/preload/cls/TSL/TestInstaller.cls b/tests/integration_tests/Test/PM/Integration/_data/simple-app/preload/cls/TSL/TestInstaller.cls new file mode 100644 index 00000000..700c35b3 --- /dev/null +++ b/tests/integration_tests/Test/PM/Integration/_data/simple-app/preload/cls/TSL/TestInstaller.cls @@ -0,0 +1,21 @@ +Class TSL.TestInstaller +{ +ClassMethod OnInstallComponent(args...) As %Status +{ + Quit $$$OK +} +ClassMethod OnUnInstallComponent(args...) As %Status +{ + Quit $$$OK +} + +ClassMethod OnConfigureComponent(args...) AS %Status +{ + Quit $$$OK +} + +ClassMethod OnUnconfigureComponent(args...) AS %Status +{ + Quit $$$OK +} +} \ No newline at end of file