mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(wafv2): persist tags on TagResource/UntagResource (#3915)
taggable() erased the resolved resource behind a private Tagged lambda, so applyTagged()'s instanceof checks never matched and the tag mutation/store.put were dead code. Dispatch on the resource's concrete type directly instead. * Fix #3910 Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
This commit is contained in:
1 parent
8ca748355d
commit
df9535d7db
2 files changed
+79
-16
No files matched your search
@@ -304,6 +304,60 @@ class WafV2IntegrationTest {
|
||||
|
||||
@Test
|
||||
@Order(15)
|
||||
void tagResourcePersistsTagsForIpSet() {
|
||||
call("TagResource",
|
||||
"{\"ResourceARN\":\"" + ipSetArn + "\",\"Tags\":[{\"Key\":\"env\",\"Value\":\"test\"},"
|
||||
+ "{\"Key\":\"team\",\"Value\":\"waf\"}]}")
|
||||
.then().statusCode(200);
|
||||
|
||||
call("ListTagsForResource", "{\"ResourceARN\":\"" + ipSetArn + "\"}")
|
||||
.then().statusCode(200)
|
||||
.body("TagInfoForResource.ResourceARN", equalTo(ipSetArn))
|
||||
.body("TagInfoForResource.TagList", hasSize(2))
|
||||
.body("TagInfoForResource.TagList.find { it.Key == 'env' }.Value", equalTo("test"))
|
||||
.body("TagInfoForResource.TagList.find { it.Key == 'team' }.Value", equalTo("waf"));
|
||||
|
||||
call("UntagResource", "{\"ResourceARN\":\"" + ipSetArn + "\",\"TagKeys\":[\"team\"]}")
|
||||
.then().statusCode(200);
|
||||
|
||||
call("ListTagsForResource", "{\"ResourceARN\":\"" + ipSetArn + "\"}")
|
||||
.then().statusCode(200)
|
||||
.body("TagInfoForResource.TagList", hasSize(1))
|
||||
.body("TagInfoForResource.TagList[0].Key", equalTo("env"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(16)
|
||||
void tagResourcePersistsTagsForWebAcl() {
|
||||
call("TagResource",
|
||||
"{\"ResourceARN\":\"" + webAclArn + "\",\"Tags\":[{\"Key\":\"owner\",\"Value\":\"floci\"}]}")
|
||||
.then().statusCode(200);
|
||||
|
||||
call("ListTagsForResource", "{\"ResourceARN\":\"" + webAclArn + "\"}")
|
||||
.then().statusCode(200)
|
||||
.body("TagInfoForResource.TagList", hasSize(1))
|
||||
.body("TagInfoForResource.TagList[0].Key", equalTo("owner"))
|
||||
.body("TagInfoForResource.TagList[0].Value", equalTo("floci"));
|
||||
|
||||
call("TagResource",
|
||||
"{\"ResourceARN\":\"" + webAclArn + "\",\"Tags\":[{\"Key\":\"owner\",\"Value\":\"floci-team\"}]}")
|
||||
.then().statusCode(200);
|
||||
|
||||
call("ListTagsForResource", "{\"ResourceARN\":\"" + webAclArn + "\"}")
|
||||
.then().statusCode(200)
|
||||
.body("TagInfoForResource.TagList", hasSize(1))
|
||||
.body("TagInfoForResource.TagList[0].Value", equalTo("floci-team"));
|
||||
|
||||
call("UntagResource", "{\"ResourceARN\":\"" + webAclArn + "\",\"TagKeys\":[\"owner\"]}")
|
||||
.then().statusCode(200);
|
||||
|
||||
call("ListTagsForResource", "{\"ResourceARN\":\"" + webAclArn + "\"}")
|
||||
.then().statusCode(200)
|
||||
.body("TagInfoForResource.TagList", hasSize(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(17)
|
||||
void teardown() {
|
||||
call("DisassociateWebACL", "{\"ResourceArn\":\"" + API_RESOURCE_ARN + "\"}")
|
||||
.then().statusCode(200);
|
||||
@@ -325,7 +379,7 @@ class WafV2IntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(16)
|
||||
@Order(18)
|
||||
void getMissingWebAclReturnsNotFound() {
|
||||
call("GetWebACL",
|
||||
"{\"Name\":\"nope\",\"Scope\":\"REGIONAL\",\"Id\":\"00000000-0000-0000-0000-000000000000\"}")
|
||||
|
||||
Reference in new issue
Block a user