-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TMS]: predefined tags What this PR does / why we need it Predefined tags implementation Reviewed-by: Anton Sidelnikov Reviewed-by: Polina Gubina
- Loading branch information
1 parent
b55cf09
commit 9ee2c76
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package tms | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/opentelekomcloud/gophertelekomcloud/acceptance/clients" | ||
"github.com/opentelekomcloud/gophertelekomcloud/openstack/tms/v1/tags" | ||
th "github.com/opentelekomcloud/gophertelekomcloud/testhelper" | ||
) | ||
|
||
func TestTMSV1Lifecycle(t *testing.T) { | ||
if os.Getenv("RUN_TMS_TAGS") == "" { | ||
t.Skip("unstable test") | ||
} | ||
client, err := clients.NewTmsV1Client() | ||
th.AssertNoErr(t, err) | ||
|
||
predefinedTags := []tags.Tag{ | ||
{ | ||
Key: "test-1", | ||
Value: "test-1", | ||
}, | ||
} | ||
|
||
createOpts := tags.BatchOpts{ | ||
Tags: predefinedTags, | ||
Action: tags.ActionCreate, | ||
} | ||
|
||
_, err = tags.BatchAction(client, "", createOpts).Extract() | ||
th.AssertNoErr(t, err) | ||
|
||
listTags, err := tags.Get(client).Extract() | ||
th.AssertNoErr(t, err) | ||
th.AssertEquals(t, listTags.Tags[0].Key, "test-1") | ||
th.AssertEquals(t, listTags.Tags[0].Value, "test-1") | ||
|
||
deleteOpts := tags.BatchOpts{ | ||
Action: tags.ActionDelete, | ||
Tags: predefinedTags, | ||
} | ||
_, err = tags.BatchAction(client, "", deleteOpts).Extract() | ||
th.AssertNoErr(t, err) | ||
|
||
_, err = tags.Get(client).Extract() | ||
th.AssertNoErr(t, err) | ||
} |
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