Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import (
)

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

toInt64Pointer := func(i int64) *int64 { return &i }
type queryResponse struct {
res datadog.MetricsQueryResponse
Expand Down Expand Up @@ -98,7 +100,10 @@ func TestProviderQueryPoints(t *testing.T) {
},
}
for _, tc := range testcases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

provider := Provider{
client: datadog.NewAPIClient(datadog.NewConfiguration()),
runQuery: func(_ datadog.ApiQueryMetricsRequest) (datadog.MetricsQueryResponse, *http.Response, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ import (
)

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

p := Provider{}
assert.Equal(t, ProviderType, p.Type())
}

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

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

provider := &Provider{
api: tc.client,
timeout: defaultTimeout,
Expand Down
9 changes: 1 addition & 8 deletions pkg/app/piped/apistore/analysisresultstore/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
Expand All @@ -14,10 +14,3 @@ go_library(
"@org_uber_go_zap//:go_default_library",
],
)

go_test(
name = "go_default_test",
size = "small",
srcs = ["store_test.go"],
embed = [":go_default_library"],
)
15 changes: 0 additions & 15 deletions pkg/app/piped/apistore/analysisresultstore/store_test.go

This file was deleted.

9 changes: 1 addition & 8 deletions pkg/app/piped/apistore/applicationstore/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
Expand All @@ -12,10 +12,3 @@ go_library(
"@org_uber_go_zap//:go_default_library",
],
)

go_test(
name = "go_default_test",
size = "small",
srcs = ["store_test.go"],
embed = [":go_default_library"],
)
15 changes: 0 additions & 15 deletions pkg/app/piped/apistore/applicationstore/store_test.go

This file was deleted.

9 changes: 1 addition & 8 deletions pkg/app/piped/apistore/commandstore/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
Expand All @@ -12,10 +12,3 @@ go_library(
"@org_uber_go_zap//:go_default_library",
],
)

go_test(
name = "go_default_test",
size = "small",
srcs = ["store_test.go"],
embed = [":go_default_library"],
)
15 changes: 0 additions & 15 deletions pkg/app/piped/apistore/commandstore/store_test.go

This file was deleted.

9 changes: 1 addition & 8 deletions pkg/app/piped/apistore/deploymentstore/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
Expand All @@ -12,10 +12,3 @@ go_library(
"@org_uber_go_zap//:go_default_library",
],
)

go_test(
name = "go_default_test",
size = "small",
srcs = ["store_test.go"],
embed = [":go_default_library"],
)
15 changes: 0 additions & 15 deletions pkg/app/piped/apistore/deploymentstore/store_test.go

This file was deleted.

9 changes: 1 addition & 8 deletions pkg/app/piped/apistore/eventstore/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
Expand All @@ -12,10 +12,3 @@ go_library(
"@org_uber_go_zap//:go_default_library",
],
)

go_test(
name = "go_default_test",
size = "small",
srcs = ["store_test.go"],
embed = [":go_default_library"],
)
15 changes: 0 additions & 15 deletions pkg/app/piped/apistore/eventstore/store_test.go

This file was deleted.

10 changes: 10 additions & 0 deletions pkg/app/piped/appconfigreporter/appconfigreporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func (f *fakeApplicationLister) List() []*model.Application {
}

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

type args struct {
repoPath string
repoID string
Expand Down Expand Up @@ -153,7 +155,10 @@ spec:
},
}
for _, tc := range testcases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

got, err := tc.reporter.findRegisteredApps(tc.args.repoPath, tc.args.repoID)
assert.Equal(t, tc.wantErr, err != nil)
assert.Equal(t, tc.want, got)
Expand All @@ -162,6 +167,8 @@ spec:
}

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

type args struct {
registeredAppPaths map[string]string
repoPath, repoID string
Expand Down Expand Up @@ -381,7 +388,10 @@ spec:
},
}
for _, tc := range testcases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

got, err := tc.reporter.findUnregisteredApps(tc.args.repoPath, tc.args.repoID)
assert.Equal(t, tc.wantErr, err != nil)
assert.Equal(t, tc.want, got)
Expand Down
6 changes: 6 additions & 0 deletions pkg/app/piped/cloudprovider/cloudrun/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ import (
)

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

const projectID = "projectID"
got := makeCloudRunParent(projectID)
want := "namespaces/projectID"
assert.Equal(t, want, got)
}

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

const (
projectID = "projectID"
serviceID = "serviceID"
Expand All @@ -38,6 +42,8 @@ func TestMakeCloudRunServiceName(t *testing.T) {
}

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

const (
projectID = "projectID"
revisionID = "revisionID"
Expand Down
20 changes: 20 additions & 0 deletions pkg/app/piped/cloudprovider/cloudrun/cloudrun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
)

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

const (
appDir = "testdata"
serviceFile = "new_manifest.yaml"
Expand All @@ -39,19 +41,25 @@ func TestLoadServiceManifest(t *testing.T) {
}

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

want := "pipecd-dev-managed-by=piped"
got := MakeManagedByPipedSelector()
assert.Equal(t, want, got)
}

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

names := []string{"test-1", "test-2", "test-3"}
got := MakeRevisionNamesSelector(names)
want := "pipecd-dev-revision-name in (test-1,test-2,test-3)"
assert.Equal(t, want, got)
}

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

sm, err := ParseServiceManifest([]byte(serviceManifest))
require.NoError(t, err)

Expand All @@ -75,6 +83,8 @@ func TestService(t *testing.T) {
}

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

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

data := []byte(tc.manifest)
sm, err := ParseServiceManifest(data)
require.NoError(t, err)
Expand All @@ -309,6 +322,8 @@ status:
}

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

rm, err := ParseRevisionManifest([]byte(revisionManifest))
require.NoError(t, err)
require.NotEmpty(t, rm)
Expand All @@ -323,6 +338,8 @@ func TestRevision(t *testing.T) {
}

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

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

data := []byte(tc.manifest)
rm, err := ParseRevisionManifest(data)
require.NoError(t, err)
Expand Down
Loading