mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-27 16:39:38 -05:00
827c4f548d
bazel-deps-mirror is an internal tools used to upload external dependencies that are referenced in the Bazel WORKSPACE to the Edgeless Systems' mirror. It also normalizes deps rules. * hack: add tool to mirror Bazel dependencies * hack: bazel-deps-mirror tests * bazel: add deps mirror commands * ci: upload Bazel dependencies on renovate PRs * update go mod * run deps_mirror_upload Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com> Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
47 lines
864 B
Go
47 lines
864 B
Go
/*
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
package issues
|
|
|
|
import (
|
|
"bytes"
|
|
"errors"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"go.uber.org/goleak"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
goleak.VerifyTestMain(m)
|
|
}
|
|
|
|
func TestMap(t *testing.T) {
|
|
assert := assert.New(t)
|
|
|
|
m := New()
|
|
assert.Equal(0, len(m))
|
|
assert.False(m.FileHasIssues("file1"))
|
|
m.Set("file1", map[string][]error{
|
|
"rule1": {errors.New("r1_issue1"), errors.New("r1_issue2")},
|
|
"rule2": {errors.New("r2_issue1")},
|
|
})
|
|
assert.Equal(3, m.IssuesPerFile("file1"))
|
|
assert.True(m.FileHasIssues("file1"))
|
|
|
|
// let report write to a buffer
|
|
b := new(bytes.Buffer)
|
|
m.Report(b)
|
|
rep := b.String()
|
|
assert.Equal(rep, `File file1 (3 issues total):
|
|
Rule rule1 (2 issues total):
|
|
r1_issue1
|
|
r1_issue2
|
|
Rule rule2 (1 issues total):
|
|
r2_issue1
|
|
`)
|
|
}
|