From ec545e03a30dd51dd203f971ec9ec623655f6eb6 Mon Sep 17 00:00:00 2001 From: Yingjian Wu Date: Sat, 6 Jul 2024 18:57:34 -0400 Subject: [PATCH] add more --- .../metacat/ParentChildRelMetadataServiceSpec.groovy | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/metacat-functional-tests/src/functionalTest/groovy/com/netflix/metacat/ParentChildRelMetadataServiceSpec.groovy b/metacat-functional-tests/src/functionalTest/groovy/com/netflix/metacat/ParentChildRelMetadataServiceSpec.groovy index df1c46a8..f6114b0d 100644 --- a/metacat-functional-tests/src/functionalTest/groovy/com/netflix/metacat/ParentChildRelMetadataServiceSpec.groovy +++ b/metacat-functional-tests/src/functionalTest/groovy/com/netflix/metacat/ParentChildRelMetadataServiceSpec.groovy @@ -578,15 +578,15 @@ class ParentChildRelMetadataServiceSpec extends Specification{ //change the config to -1, and now it should allow new creation when: - if (!maxAllowPerTablePerRelTypeStr.isEmpty()) { + if (!maxAllowPerTablePerRelTypeStr.isEmpty() && maxAllowPerTablePerRelTypeStr.contains("CLONE,testhive/test/parent")) { def p = /CLONE,testhive\/test\/parent,\d+/ maxAllowPerTablePerRelTypeStr = maxAllowPerTablePerRelTypeStr.replaceAll(p, "CLONE,testhive/test/parent,-1") parentChildProps.setMaxAllowPerTablePerRelType(maxAllowPerTablePerRelTypeStr) - } else if (!maxAllowPerDBPerRelTypeStr.isEmpty()) { + } else if (!maxAllowPerDBPerRelTypeStr.isEmpty() && maxAllowPerDBPerRelTypeStr.contains("CLONE,test")) { def pattern = /CLONE,test,\d+/ maxAllowPerDBPerRelTypeStr = maxAllowPerDBPerRelTypeStr.replaceAll(pattern, "CLONE,test,-1") parentChildProps.setMaxAllowPerDBPerRelType(maxAllowPerDBPerRelTypeStr) - } else if (!defaultMaxAllowPerRelStr.isEmpty()) { + } else if (!defaultMaxAllowPerRelStr.isEmpty() && defaultMaxAllowPerRelStr.contains("CLONE")) { def pattern = /CLONE,\d+/ defaultMaxAllowPerRelStr = defaultMaxAllowPerRelStr.replaceAll(pattern, "CLONE,-1") parentChildProps.setDefaultMaxAllowPerRelType(defaultMaxAllowPerRelStr) @@ -595,11 +595,15 @@ class ParentChildRelMetadataServiceSpec extends Specification{ } child_name = targetChildPrefix + (expectedChildAllowCount + 1) childQualifiedName = QualifiedName.ofTable(catalog, targetChildDB, child_name) - then: service.createParentChildRelation(parentQName, targetParentTable, childQualifiedName, child_name, targetType, parentChildProps) + then: noExceptionThrown() service.getChildren(parentQName).size() == (expectedChildAllowCount + 2) + assert (maxAllow == -1 ? 1 : 0) + + (defaultMaxAllowPerRelStr.contains("-1") ? 1 : 0) + + (maxAllowPerDBPerRelTypeStr.contains("-1") ? 1 : 0) + + (maxAllowPerTablePerRelTypeStr.contains("-1") ? 1 : 0) == 1 where: maxAllow | defaultMaxAllowPerRelStr | maxAllowPerDBPerRelTypeStr | maxAllowPerTablePerRelTypeStr | expectedChildAllowCount