[#6] Fix test struct tag naming

Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
Denis Kirillov 2024-11-21 12:59:30 +03:00
parent e30bbe87e9
commit b08b08d6a0
4 changed files with 72 additions and 49 deletions

View file

@ -161,6 +161,8 @@ func formTestResult(group s3.Group, testsMap map[string]bool) TestResult {
color = templates.BlueColor color = templates.BlueColor
} else if strings.Contains(group.Comment, "Not applicable") { } else if strings.Contains(group.Comment, "Not applicable") {
color = templates.BlackColor color = templates.BlackColor
} else if ln == 0 && !group.Skip {
color = templates.GreenColor
} }
if color == "" { if color == "" {

3
go.mod
View file

@ -5,15 +5,18 @@ go 1.20
require ( require (
github.com/spf13/cobra v1.7.0 github.com/spf13/cobra v1.7.0
github.com/spf13/viper v1.16.0 github.com/spf13/viper v1.16.0
github.com/stretchr/testify v1.8.3
) )
require ( require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect github.com/magiconair/properties v1.8.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/afero v1.9.5 // indirect github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.1 // indirect github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect

View file

@ -129,7 +129,7 @@
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "DeleteBucketCors", "name": "DeleteBucketCors",
@ -149,21 +149,21 @@
"test_delete_bucket_encryption_kms" "test_delete_bucket_encryption_kms"
], ],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "DeleteBucketIntelligentTieringConfiguration", "name": "DeleteBucketIntelligentTieringConfiguration",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "DeleteBucketInventoryConfiguration", "name": "DeleteBucketInventoryConfiguration",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "DeleteBucketLifecycle", "name": "DeleteBucketLifecycle",
@ -180,14 +180,14 @@
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "DeleteBucketOwnershipControls", "name": "DeleteBucketOwnershipControls",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "DeleteBucketPolicy", "name": "DeleteBucketPolicy",
@ -204,7 +204,7 @@
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "DeleteBucketTagging", "name": "DeleteBucketTagging",
@ -221,7 +221,7 @@
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "DeleteObject", "name": "DeleteObject",
@ -269,7 +269,7 @@
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "GetBucketAccelerateConfiguration", "name": "GetBucketAccelerateConfiguration",
@ -293,7 +293,7 @@
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "GetBucketCors", "name": "GetBucketCors",
@ -313,21 +313,21 @@
"test_get_bucket_encryption_kms" "test_get_bucket_encryption_kms"
], ],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "GetBucketIntelligentTieringConfiguration", "name": "GetBucketIntelligentTieringConfiguration",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "GetBucketInventoryConfiguration", "name": "GetBucketInventoryConfiguration",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "GetBucketLifecycle", "name": "GetBucketLifecycle",
@ -363,35 +363,35 @@
"test_logging_toggle" "test_logging_toggle"
], ],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "GetBucketMetricsConfiguration", "name": "GetBucketMetricsConfiguration",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "GetBucketNotification", "name": "GetBucketNotification",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "GetBucketNotificationConfiguration", "name": "GetBucketNotificationConfiguration",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "GetBucketOwnershipControls", "name": "GetBucketOwnershipControls",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "GetBucketPolicy", "name": "GetBucketPolicy",
@ -408,14 +408,14 @@
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": false, "skip": false,
"comment": "Party supported" "comment": "Party supported, but there are not compatibility tests"
}, },
{ {
"name": "GetBucketReplication", "name": "GetBucketReplication",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "GetBucketRequestPayment", "name": "GetBucketRequestPayment",
@ -449,7 +449,7 @@
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "GetObject", "name": "GetObject",
@ -494,7 +494,7 @@
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": false, "skip": false,
"comment": "" "comment": "Supported, but there are not compatibility tests"
}, },
{ {
"name": "GetObjectLegalHold", "name": "GetObjectLegalHold",
@ -552,7 +552,7 @@
"test_get_default_public_block" "test_get_default_public_block"
], ],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "HeadBucket", "name": "HeadBucket",
@ -581,28 +581,28 @@
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "ListBucketIntelligentTieringConfigurations", "name": "ListBucketIntelligentTieringConfigurations",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "ListBucketInventoryConfigurations", "name": "ListBucketInventoryConfigurations",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "ListBucketMetricsConfigurations", "name": "ListBucketMetricsConfigurations",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "ListBuckets", "name": "ListBuckets",
@ -739,7 +739,7 @@
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": false, "skip": false,
"comment": "" "comment": "Supported, but there are not compatibility tests"
}, },
{ {
"name": "PutBucketAccelerateConfiguration", "name": "PutBucketAccelerateConfiguration",
@ -752,7 +752,7 @@
"name": "PutBucketAcl", "name": "PutBucketAcl",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"include":[ "include": [
"BucketACL" "BucketACL"
], ],
"skip": false, "skip": false,
@ -763,7 +763,7 @@
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "PutBucketCors", "name": "PutBucketCors",
@ -795,21 +795,21 @@
"test_sse_kms_default_upload_8mb" "test_sse_kms_default_upload_8mb"
], ],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "PutBucketIntelligentTieringConfiguration", "name": "PutBucketIntelligentTieringConfiguration",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "PutBucketInventoryConfiguration", "name": "PutBucketInventoryConfiguration",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "PutBucketLifecycle", "name": "PutBucketLifecycle",
@ -836,35 +836,35 @@
"test_logging_toggle" "test_logging_toggle"
], ],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "PutBucketMetricsConfiguration", "name": "PutBucketMetricsConfiguration",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "PutBucketNotification", "name": "PutBucketNotification",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "PutBucketNotificationConfiguration", "name": "PutBucketNotificationConfiguration",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "PutBucketOwnershipControls", "name": "PutBucketOwnershipControls",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "PutBucketPolicy", "name": "PutBucketPolicy",
@ -881,7 +881,7 @@
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "PutBucketRequestPayment", "name": "PutBucketRequestPayment",
@ -915,7 +915,7 @@
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "PutObject", "name": "PutObject",
@ -1005,14 +1005,14 @@
"test_ignore_public_acls" "test_ignore_public_acls"
], ],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "RestoreObject", "name": "RestoreObject",
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "SelectObjectContent", "name": "SelectObjectContent",
@ -1054,7 +1054,7 @@
"test_output_serial_expressions" "test_output_serial_expressions"
], ],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "UploadPart", "name": "UploadPart",
@ -1100,7 +1100,7 @@
"tag": "API", "tag": "API",
"tests": [], "tests": [],
"skip": true, "skip": true,
"comment": "Not supported yet, but will be in future" "comment": "Not supported"
}, },
{ {
"name": "BucketPolicy", "name": "BucketPolicy",
@ -1195,7 +1195,7 @@
}, },
{ {
"name": "BucketACL", "name": "BucketACL",
"tags": "Features", "tag": "Features",
"tests": [ "tests": [
"test_bucket_put_bad_canned_acl", "test_bucket_put_bad_canned_acl",
"test_bucket_list_objects_anonymous", "test_bucket_list_objects_anonymous",
@ -1210,7 +1210,7 @@
}, },
{ {
"name": "BucketVersioning", "name": "BucketVersioning",
"tags": "Features", "tag": "Features",
"tests": [ "tests": [
"test_object_lock_put_obj_lock", "test_object_lock_put_obj_lock",
"test_multipart_copy_versioned", "test_multipart_copy_versioned",
@ -1240,7 +1240,7 @@
}, },
{ {
"name": "MultipartUpload", "name": "MultipartUpload",
"tags": "Features", "tag": "Features",
"tests": [ "tests": [
"test_multipart_upload" "test_multipart_upload"
], ],
@ -1249,13 +1249,14 @@
"CompleteMultipartUpload", "CompleteMultipartUpload",
"ListMultipartUploads", "ListMultipartUploads",
"UploadPart", "UploadPart",
"UploadPartCopy" "UploadPartCopy",
"ListParts"
], ],
"skip": false, "skip": false,
"comment": "" "comment": ""
}, },
{ {
"name": "encryption", "name": "Encryption",
"tag": "Features", "tag": "Features",
"tests": [ "tests": [
"test_encrypted_transfer_1b", "test_encrypted_transfer_1b",

View file

@ -0,0 +1,17 @@
package s3
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestStructParsing(t *testing.T) {
structure, err := ParseTestsStruct()
require.NoError(t, err)
for _, group := range structure.Groups {
require.NotEmptyf(t, group.Tag, "group tag must not be empty: %v", group)
require.NotEmptyf(t, group.Name, "group name must not be empty: %v", group)
}
}