feature/correct_test_groups #2
9 changed files with 456 additions and 706 deletions
23
.forgejo/workflows/builds.yml
Normal file
23
.forgejo/workflows/builds.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
builds:
|
||||
name: Builds
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
go_versions: [ '1.22', '1.23' ]
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '${{ matrix.go_versions }}'
|
||||
|
||||
- name: Build binary
|
||||
run: make
|
||||
|
||||
- name: Check dirty suffix
|
||||
run: if [[ $(make version) == *"dirty"* ]]; then echo "Version has dirty suffix" && exit 1; fi
|
20
.forgejo/workflows/dco.yml
Normal file
20
.forgejo/workflows/dco.yml
Normal file
|
@ -0,0 +1,20 @@
|
|||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
dco:
|
||||
name: DCO
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '1.23'
|
||||
|
||||
- name: Run commit format checker
|
||||
uses: https://git.frostfs.info/TrueCloudLab/dco-go@v3
|
||||
with:
|
||||
from: 'origin/${{ github.event.pull_request.base.ref }}'
|
38
.forgejo/workflows/tests.yml
Normal file
38
.forgejo/workflows/tests.yml
Normal file
|
@ -0,0 +1,38 @@
|
|||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '1.23'
|
||||
cache: true
|
||||
|
||||
- name: Run linters
|
||||
run: make lint
|
||||
|
||||
tests:
|
||||
name: Tests
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
go_versions: [ '1.22', '1.23' ]
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '${{ matrix.go_versions }}'
|
||||
|
||||
- name: Update Go modules
|
||||
run: make dep
|
||||
|
||||
- name: Run tests
|
||||
run: make test
|
21
.forgejo/workflows/vulncheck.yml
Normal file
21
.forgejo/workflows/vulncheck.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
vulncheck:
|
||||
name: Vulncheck
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '1.23'
|
||||
|
||||
- name: Install govulncheck
|
||||
run: go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||
|
||||
- name: Run govulncheck
|
||||
run: govulncheck ./...
|
1
CODEOWNERS
Normal file
1
CODEOWNERS
Normal file
|
@ -0,0 +1 @@
|
|||
.* @alexvanin @dkirillov
|
|
@ -27,6 +27,7 @@ s3-tests-parser compatibility suite.json --format json --output-format md --outp
|
|||
|
||||
type (
|
||||
Results struct {
|
||||
Verbose bool
|
||||
Legend []Status
|
||||
TagGroups []TagGroup
|
||||
}
|
||||
|
@ -42,11 +43,13 @@ type (
|
|||
}
|
||||
|
||||
TestResult struct {
|
||||
Color string
|
||||
Name string
|
||||
Comment string
|
||||
Passed int
|
||||
Total int
|
||||
Color string
|
||||
Name string
|
||||
Comment string
|
||||
Passed int
|
||||
Total int
|
||||
FailedTests []string
|
||||
PassedTests []string
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -54,12 +57,14 @@ const (
|
|||
formatFlag = "format"
|
||||
outputFlag = "output"
|
||||
outputFormatFlag = "output-format"
|
||||
verboseFlag = "verbose"
|
||||
)
|
||||
|
||||
func initCompatibilityCmd() {
|
||||
compatibilityCmd.Flags().String(formatFlag, "csv", "format of input test suite file")
|
||||
compatibilityCmd.Flags().String(outputFlag, "", "file to write output, if missed the stdout is used")
|
||||
compatibilityCmd.Flags().String(outputFormatFlag, "txt", "format of output")
|
||||
compatibilityCmd.Flags().Bool(verboseFlag, false, "produce additional info")
|
||||
}
|
||||
|
||||
func runCompatibilityCmd(cmd *cobra.Command, args []string) error {
|
||||
|
@ -78,6 +83,7 @@ func runCompatibilityCmd(cmd *cobra.Command, args []string) error {
|
|||
}
|
||||
|
||||
res := formResults(testStruct, testsMap)
|
||||
res.Verbose = viper.GetBool(verboseFlag)
|
||||
return printResults(cmd, res)
|
||||
}
|
||||
|
||||
|
@ -96,7 +102,7 @@ var legend = []Status{
|
|||
},
|
||||
{
|
||||
Color: templates.BlueColor,
|
||||
Description: "Not supported yet, but will be in future",
|
||||
Description: "Not supported",
|
||||
},
|
||||
{
|
||||
Color: templates.BlackColor,
|
||||
|
@ -106,12 +112,21 @@ var legend = []Status{
|
|||
|
||||
func formResults(testStruct s3.TestsStructure, testsMap map[string]bool) Results {
|
||||
tagGroups := make(map[string]TagGroup)
|
||||
groupTests := make(map[string][]string)
|
||||
for _, group := range testStruct.Groups {
|
||||
groupTests[group.Name] = group.Tests
|
||||
}
|
||||
|
||||
for _, group := range testStruct.Groups {
|
||||
tagGroup, ok := tagGroups[group.Tag]
|
||||
if !ok {
|
||||
tagGroup.Name = group.Tag
|
||||
}
|
||||
|
||||
for _, n := range group.Include {
|
||||
group.Tests = append(group.Tests, groupTests[n]...)
|
||||
}
|
||||
|
||||
tagGroup.Tests = append(tagGroup.Tests, formTestResult(group, testsMap))
|
||||
tagGroups[group.Tag] = tagGroup
|
||||
}
|
||||
|
@ -130,16 +145,19 @@ func formResults(testStruct s3.TestsStructure, testsMap map[string]bool) Results
|
|||
|
||||
func formTestResult(group s3.Group, testsMap map[string]bool) TestResult {
|
||||
ln := len(group.Tests)
|
||||
pass := 0
|
||||
|
||||
var failed []string
|
||||
var passed []string
|
||||
for _, test := range group.Tests {
|
||||
if testsMap[test] {
|
||||
pass++
|
||||
passed = append(passed, test)
|
||||
} else {
|
||||
failed = append(failed, test)
|
||||
}
|
||||
}
|
||||
|
||||
var color string
|
||||
if strings.Contains(group.Comment, "Not supported yet") {
|
||||
if strings.Contains(group.Comment, "Not supported") {
|
||||
color = templates.BlueColor
|
||||
} else if strings.Contains(group.Comment, "Not applicable") {
|
||||
color = templates.BlackColor
|
||||
|
@ -147,7 +165,7 @@ func formTestResult(group s3.Group, testsMap map[string]bool) TestResult {
|
|||
|
||||
if color == "" {
|
||||
color = templates.RedColor
|
||||
rate := float64(pass) / float64(ln)
|
||||
rate := float64(len(passed)) / float64(ln)
|
||||
if rate > 0.9 {
|
||||
color = templates.GreenColor
|
||||
} else if rate > 0.5 {
|
||||
|
@ -156,11 +174,13 @@ func formTestResult(group s3.Group, testsMap map[string]bool) TestResult {
|
|||
}
|
||||
|
||||
return TestResult{
|
||||
Color: color,
|
||||
Name: group.Name,
|
||||
Comment: group.Comment,
|
||||
Passed: pass,
|
||||
Total: ln,
|
||||
Color: color,
|
||||
Name: group.Name,
|
||||
Comment: group.Comment,
|
||||
Passed: len(passed),
|
||||
Total: ln,
|
||||
FailedTests: failed,
|
||||
PassedTests: passed,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -19,6 +19,7 @@ type Group struct {
|
|||
Skip bool `json:"skip"`
|
||||
Comment string `json:"comment"`
|
||||
Tests []string `json:"tests"`
|
||||
Include []string `json:"include"`
|
||||
}
|
||||
|
||||
func ParseTestsStruct() (TestsStructure, error) {
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
# S3 Protocol Compatibility
|
||||
{{$verbose := .Verbose}}
|
||||
{{range .TagGroups}}
|
||||
## {{.Name}}
|
||||
{{range .Tests}}
|
||||
{{colorToTerminal .Color}}{{.Name}}: {{.Passed}}/{{.Total}}; {{.Comment}} {{colorToTerminal "black"}} {{end}}
|
||||
{{colorToTerminal .Color}}{{.Name}}: {{.Passed}}/{{.Total}}; {{.Comment}} {{colorToTerminal "black"}}{{if $verbose}}
|
||||
failed: {{.FailedTests}}
|
||||
passed: {{.PassedTests}}
|
||||
{{end}}{{end}}
|
||||
{{end}}
|
||||
|
|
Loading…
Reference in a new issue