Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/app/piped/cloudprovider/cloudrun/diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ func TestDiffResult_NoChange(t *testing.T) {
}

func TestDiffResult_Render(t *testing.T) {
t.Parallel()

old, err := loadServiceManifest("testdata/old_manifest.yaml")
require.NoError(t, err)

Expand Down Expand Up @@ -100,6 +102,8 @@ func TestDiffResult_Render(t *testing.T) {
}

func TestDiffByCommand(t *testing.T) {
t.Parallel()

testcases := []struct {
name string
command string
Expand Down Expand Up @@ -140,7 +144,10 @@ func TestDiffByCommand(t *testing.T) {
},
}
for _, tc := range testcases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

old, err := loadServiceManifest(tc.oldManifest)
require.NoError(t, err)

Expand Down
2 changes: 2 additions & 0 deletions pkg/app/piped/cloudprovider/kubernetes/diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ func TestGroupManifests(t *testing.T) {
}

func TestDiffByCommand(t *testing.T) {
t.Parallel()

testcases := []struct {
name string
command string
Expand Down
4 changes: 4 additions & 0 deletions pkg/app/piped/cloudprovider/kubernetes/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import (
)

func TestTemplateLocalChart(t *testing.T) {
t.Parallel()

var (
ctx = context.Background()
appName = "testapp"
Expand All @@ -48,6 +50,8 @@ func TestTemplateLocalChart(t *testing.T) {
}

func TestTemplateLocalChart_WithNamespace(t *testing.T) {
t.Parallel()

var (
ctx = context.Background()
appName = "testapp"
Expand Down
2 changes: 2 additions & 0 deletions pkg/app/piped/cloudprovider/kubernetes/kustomize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (
)

func TestKustomizeTemplate(t *testing.T) {
t.Parallel()

var (
ctx = context.TODO()
appName = "testapp"
Expand Down
4 changes: 4 additions & 0 deletions pkg/app/piped/eventwatcher/eventwatcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ func TestModifyYAML(t *testing.T) {
}

func TestModifyText(t *testing.T) {
t.Parallel()

testcases := []struct {
name string
path string
Expand Down Expand Up @@ -228,7 +230,9 @@ spec:
},
}
for _, tc := range testcases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
got, gotUpToDate, err := modifyText(tc.path, tc.regex, tc.newValue)
assert.Equal(t, tc.wantErr, err != nil)
assert.Equal(t, tc.want, got)
Expand Down
2 changes: 2 additions & 0 deletions pkg/app/piped/executor/analysis/mannwhitney/udist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ func BenchmarkUDist(b *testing.B) {
}

func TestUDistTies(t *testing.T) {
t.Parallel()

makeTable := func(m, N int, t []int, minx, maxx float64) [][]float64 {
out := [][]float64{}
dist := UDist{N1: m, N2: N - m, T: t}
Expand Down
5 changes: 5 additions & 0 deletions pkg/app/piped/executor/kubernetes/kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,8 @@ data:
}

func TestPatchManifest(t *testing.T) {
t.Parallel()

testcases := []struct {
name string
manifests string
Expand Down Expand Up @@ -850,7 +852,10 @@ func TestPatchManifest(t *testing.T) {
}

for _, tc := range testcases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

manifests, err := provider.LoadManifestsFromYAMLFile(tc.manifests)
require.NoError(t, err)

Expand Down
5 changes: 5 additions & 0 deletions pkg/app/piped/planner/kubernetes/kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@ func TestDecideStrategy(t *testing.T) {
}

func TestDetermineVersion(t *testing.T) {
t.Parallel()

testcases := []struct {
name string
manifests string
Expand Down Expand Up @@ -428,7 +430,10 @@ func TestDetermineVersion(t *testing.T) {
}

for _, tc := range testcases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

manifests, err := provider.LoadManifestsFromYAMLFile(tc.manifests)
require.NoError(t, err)

Expand Down
9 changes: 8 additions & 1 deletion pkg/app/piped/sourcedecrypter/decrypter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ func (d testSecretDecrypter) Decrypt(text string) (string, error) {
}

func TestDecryptSecrets(t *testing.T) {
t.Parallel()

workspace, err := os.MkdirTemp("", "test-decrypt-secrets")
require.NoError(t, err)
defer os.RemoveAll(workspace)
t.Cleanup(func() {
os.RemoveAll(workspace)
})

dcr := testSecretDecrypter{
prefix: "decrypted-",
Expand Down Expand Up @@ -140,7 +144,10 @@ func TestDecryptSecrets(t *testing.T) {
}

for _, tc := range testcases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

appDir, err := os.MkdirTemp(workspace, "app-dir")
require.NoError(t, err)

Expand Down
2 changes: 2 additions & 0 deletions pkg/app/server/apikeyverifier/verifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ func (g *fakeAPIKeyGetter) Get(_ context.Context, id string) (*model.APIKey, err
}

func TestVerify(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand Down
2 changes: 2 additions & 0 deletions pkg/app/server/pipedverifier/verifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ func (g *fakePipedGetter) Get(_ context.Context, id string) (*model.Piped, error
}

func TestVerify(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand Down
5 changes: 5 additions & 0 deletions pkg/config/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ func TestGenericTriggerConfiguration(t *testing.T) {
}

func TestTrueByDefaultBoolConfiguration(t *testing.T) {
t.Parallel()

testcases := []struct {
fileName string
expectedKind Kind
Expand Down Expand Up @@ -436,7 +438,10 @@ func TestTrueByDefaultBoolConfiguration(t *testing.T) {
},
}
for _, tc := range testcases {
tc := tc
t.Run(tc.fileName, func(t *testing.T) {
t.Parallel()

cfg, err := LoadFromYAML(tc.fileName)
require.Equal(t, tc.expectedError, err)
if err == nil {
Expand Down
2 changes: 2 additions & 0 deletions pkg/crypto/key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
)

func TestGenerateRSAPems(t *testing.T) {
t.Parallel()

private, public, err := GenerateRSAPems(0)
require.Error(t, err)
assert.Nil(t, private)
Expand Down
8 changes: 8 additions & 0 deletions pkg/git/repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (
)

func TestGetCommitHashForRev(t *testing.T) {
t.Parallel()

faker, err := newFaker()
require.NoError(t, err)
defer faker.clean()
Expand Down Expand Up @@ -53,6 +55,8 @@ func TestGetCommitHashForRev(t *testing.T) {
}

func TestChangedFiles(t *testing.T) {
t.Parallel()

faker, err := newFaker()
require.NoError(t, err)
defer faker.clean()
Expand Down Expand Up @@ -104,6 +108,8 @@ func TestChangedFiles(t *testing.T) {
}

func TestAddCommit(t *testing.T) {
t.Parallel()

faker, err := newFaker()
require.NoError(t, err)
defer faker.clean()
Expand Down Expand Up @@ -142,6 +148,8 @@ func TestAddCommit(t *testing.T) {
}

func TestCommitChanges(t *testing.T) {
t.Parallel()

faker, err := newFaker()
require.NoError(t, err)
defer faker.clean()
Expand Down
5 changes: 5 additions & 0 deletions pkg/jwt/verifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (
)

func TestVerify(t *testing.T) {
t.Parallel()

now := time.Now()

testcases := []struct {
Expand Down Expand Up @@ -110,7 +112,10 @@ func TestVerify(t *testing.T) {

testFunc := func(s Signer, v Verifier) {
for _, tc := range testcases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

token, err := s.Sign(tc.claims)
require.NoError(t, err)
require.True(t, len(token) > 0)
Expand Down
2 changes: 2 additions & 0 deletions pkg/model/apikey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
)

func TestGenerateAPIKey(t *testing.T) {
t.Parallel()

id := "test-id"
key, hash, err := GenerateAPIKey(id)
require.NoError(t, err)
Expand Down
4 changes: 4 additions & 0 deletions pkg/model/piped_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ import (
)

func TestGeneratePipedKey(t *testing.T) {
t.Parallel()

key, hash, err := GeneratePipedKey()
assert.NoError(t, err)
assert.True(t, len(key) > 0)
assert.True(t, len(hash) > 0)
}

func TestPipedCheckKey(t *testing.T) {
t.Parallel()

key, hash, err := GeneratePipedKey()
require.NoError(t, err)

Expand Down
4 changes: 4 additions & 0 deletions pkg/model/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ func TestRedactSensitiveData(t *testing.T) {
}

func TestUpdateProjectStaticUser(t *testing.T) {
t.Parallel()

cases := []struct {
name string
username string
Expand All @@ -94,7 +96,9 @@ func TestUpdateProjectStaticUser(t *testing.T) {
}

for _, tc := range cases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
p := &ProjectStaticUser{}
p.Update(tc.username, tc.password)
assert.Equal(t, tc.expectUsername, p.Username)
Expand Down