Skip to content

Commit

Permalink
add more
Browse files Browse the repository at this point in the history
  • Loading branch information
Yingjian Wu committed Jul 6, 2024
1 parent d38b293 commit ec545e0
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit ec545e0

Please sign in to comment.