Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-Id: I5567a2ab348909aa59f998610bf4fb442c8d2ea4 Closes-Bug: #1772594
- Loading branch information
1 parent
ee55942
commit a019489
Showing
7 changed files
with
146 additions
and
2 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...tests/src/test/groovy/net/juniper/contrail/vro/tests/workflows/CreateGlobalTagSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (c) 2018 Juniper Networks, Inc. All rights reserved. | ||
*/ | ||
|
||
package net.juniper.contrail.vro.tests.workflows | ||
|
||
import net.juniper.contrail.api.Status | ||
import net.juniper.contrail.api.types.Tag | ||
|
||
class CreateGlobalTagSpec extends WorkflowSpec { | ||
|
||
def createGlobalTag = workflowFromScript("Create global tag") | ||
def tagValue = "my-global-value" | ||
def tagType = "my-global-tag" | ||
|
||
def "Creating global tag"() { | ||
given: | ||
def connection = dependencies.connection | ||
|
||
connectorMock.read(_) >> Status.success() | ||
|
||
when: "Script is executed" | ||
invokeFunction( | ||
createGlobalTag, | ||
connection, | ||
tagType, | ||
tagValue | ||
) | ||
|
||
then: "Tag with given type and value is created" | ||
1 * connectorMock.create({ | ||
def _it = it as Tag | ||
_it.value == tagValue && _it.typeName == tagType | ||
}) >> Status.success() | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...ts/src/test/groovy/net/juniper/contrail/vro/tests/workflows/CreateTagInProjectSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (c) 2018 Juniper Networks, Inc. All rights reserved. | ||
*/ | ||
|
||
package net.juniper.contrail.vro.tests.workflows | ||
|
||
import net.juniper.contrail.api.Status | ||
import net.juniper.contrail.api.types.Tag | ||
|
||
class CreateTagInProjectSpec extends WorkflowSpec { | ||
|
||
def createTagInProject = workflowFromScript("Create tag in project") | ||
def tagValue = "my-project-scoped-value" | ||
def tagType = "my-project-scoped-tag" | ||
|
||
def "Creating tag in project"() { | ||
given: | ||
def project = dependencies.someProject() | ||
|
||
connectorMock.read(_) >> Status.success() | ||
|
||
when: "Script is executed" | ||
invokeFunction( | ||
createTagInProject, | ||
project, | ||
tagType, | ||
tagValue | ||
) | ||
|
||
then: "Tag with given type and value is created" | ||
1 * connectorMock.create({ | ||
def _it = it as Tag | ||
_it.value == tagValue && _it.typeName == tagType && | ||
_it.parentUuid == project.uuid | ||
}) >> Status.success() | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...l-tests/src/test/groovy/net/juniper/contrail/vro/tests/workflows/CreateTagTypeSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (c) 2018 Juniper Networks, Inc. All rights reserved. | ||
*/ | ||
|
||
package net.juniper.contrail.vro.tests.workflows | ||
|
||
import net.juniper.contrail.api.Status | ||
|
||
class CreateTagTypeSpec extends WorkflowSpec { | ||
|
||
def createTagType = workflowFromScript("Create tag type") | ||
def tagName = "my-custom-tag" | ||
|
||
def "Creating tag type"() { | ||
given: | ||
def connection = dependencies.connection | ||
|
||
connectorMock.read(_) >> Status.success() | ||
|
||
when: "Script is executed" | ||
invokeFunction( | ||
createTagType, | ||
tagName, | ||
connection | ||
) | ||
|
||
then: "Tag type with given name is created" | ||
1 * connectorMock.create({it.name == tagName}) >> Status.success() | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...l-tests/src/test/groovy/net/juniper/contrail/vro/tests/workflows/DeleteTagTypeSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (c) 2018 Juniper Networks, Inc. All rights reserved. | ||
*/ | ||
|
||
package net.juniper.contrail.vro.tests.workflows | ||
|
||
import net.juniper.contrail.api.Status | ||
import net.juniper.contrail.api.types.TagType | ||
|
||
class DeleteTagTypeSpec extends WorkflowSpec { | ||
|
||
def deleteTagType = workflowFromScript("Delete tag type") | ||
|
||
def "Deleting tag type"() { | ||
given: | ||
def tagType = dependencies.someTagType() | ||
|
||
when: "Script is executed" | ||
invokeFunction( | ||
deleteTagType, | ||
tagType | ||
) | ||
|
||
then: "Tag type with given name is deleted" | ||
1 * connectorMock.delete({ | ||
def _it = it as TagType | ||
_it.uuid == tagType.uuid && _it.name == tagType.name | ||
}) >> Status.success() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters