Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More v1 CI fixes #457

Closed
wants to merge 11 commits into from
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 12 additions & 4 deletions src/cls/IPM/ResourceProcessor/Default/Document.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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))
Expand Down
14 changes: 10 additions & 4 deletions src/cls/IPM/Test/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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) {
Expand All @@ -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()
}
Expand All @@ -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"
Expand Down Expand Up @@ -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_"'"))
Expand Down
6 changes: 6 additions & 0 deletions src/cls/IPM/Utils/Build.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 {
Expand All @@ -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:
Expand All @@ -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 {
Expand All @@ -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:
Expand All @@ -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 {
Expand Down
47 changes: 26 additions & 21 deletions tests/integration_tests/Test/PM/Integration/Base.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Method TestEverything()
New $Namespace
Set tOrigNS = $Namespace
Try {
If '$$$AssertStatusOK(..Setup()) {
If '$$$AssertStatusOK(..Setup()) || ..SkipTest {
Quit
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Method TestEverything()
New $Namespace
Set tOrigNS = $Namespace
Try {
If '$$$AssertStatusOK(..Setup()) {
If '$$$AssertStatusOK(..Setup()) || ..SkipTest {
Quit
}

Expand Down
22 changes: 18 additions & 4 deletions tests/integration_tests/Test/PM/Integration/Resources.cls
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -37,6 +48,9 @@ Method TestResourceTypes()
} Catch e {
Do $$$AssertStatusOK(e.AsStatus(),"An exception occurred.")
}

Set $Namespace = oldNamespace
Do ..TearDown()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<Resources>
<Resource Name="TSL.SimpleAppInclude.INC" Preload="true">
</Resource>
<Resource Name="TSL.TestInstaller.CLS" Preload="true">
</Resource>
<Resource Name="SimpleApp.Routine.MAC" Deploy="true">
</Resource>
<Resource Name="TSL.SqlCompute.PKG">
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading