Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Commit

Permalink
fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
idoqo committed Mar 14, 2022
1 parent b4dbb6b commit 1985d98
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion api-tests/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func AssertAPIErrorf(t TestingT, actual error, httpStatus int, grpcCode codes.Co
if len(a) != 0 {
format = fmt.Sprintf(format, a...)
}
assert.Equal(t, format, errorField.String())
assert.Contains(t, errorField.String(), format)
}

func ExpectFailure(t *testing.T, link string) *expectedFailureTestingT {
Expand Down
4 changes: 2 additions & 2 deletions api-tests/server/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func TestSetup(t *testing.T) {
"swagger/": 301,

"v1/readyz": 200,
"v1/AWSInstanceCheck": 405, // only POST is expected
"v1/AWSInstanceCheck": 501, // only POST is expected and other request methods are seen as unimplemented
"v1/version": 401, // Grafana authentication required
}
for path, code := range paths {
Expand Down Expand Up @@ -173,7 +173,7 @@ func TestSetup(t *testing.T) {

resp, b := doRequest(t, client, req)
assert.Equal(t, 200, resp.StatusCode, "response:\n%s", b)
assert.Equal(t, "{\n\n}", string(b), "response:\n%s", b)
assert.Equal(t, "{}", string(b), "response:\n%s", b)
})
}

Expand Down
2 changes: 1 addition & 1 deletion api-tests/server/checks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func TestChangeSecurityChecks(t *testing.T) {
}

_, err = managementClient.Default.SecurityChecks.ChangeSecurityChecks(params)
pmmapitests.AssertAPIErrorf(t, err, 400, codes.InvalidArgument, "unknown value \"\\\"unknown_interval\\\"\" for enum management.SecurityCheckInterval")
pmmapitests.AssertAPIErrorf(t, err, 400, codes.InvalidArgument, `invalid value for enum type: "unknown_interval"`)

resp, err = managementClient.Default.SecurityChecks.ListSecurityChecks(nil)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion api-tests/server/readyz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestReadyz(t *testing.T) {
b, err := ioutil.ReadAll(resp.Body)
require.NoError(t, err)
assert.Equal(t, 200, resp.StatusCode, "response:\n%s", b)
assert.Equal(t, "{\n\n}", string(b))
assert.Equal(t, "{}", string(b))
})
}
}
20 changes: 10 additions & 10 deletions api-tests/server/settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ func TestSettings(t *testing.T) {
Context: pmmapitests.Context,
})
pmmapitests.AssertAPIErrorf(t, err, 400, codes.InvalidArgument,
`bad Duration: time: missing unit in duration "1"`)
`invalid google.protobuf.Duration value "1"`)
assert.Empty(t, res)
})

Expand Down Expand Up @@ -606,7 +606,7 @@ func TestSettings(t *testing.T) {
Context: pmmapitests.Context,
})
pmmapitests.AssertAPIErrorf(t, err, 400, codes.InvalidArgument,
`bad Duration: time: missing unit in duration "1"`)
`invalid google.protobuf.Duration value "1"`)
assert.Empty(t, res)
})

Expand Down Expand Up @@ -652,7 +652,7 @@ func TestSettings(t *testing.T) {
Context: pmmapitests.Context,
})
pmmapitests.AssertAPIErrorf(t, err, 400, codes.InvalidArgument,
`bad Duration: time: missing unit in duration "1"`)
`invalid google.protobuf.Duration value "1"`)
assert.Empty(t, res)
})

Expand Down Expand Up @@ -680,7 +680,7 @@ func TestSettings(t *testing.T) {
Context: pmmapitests.Context,
})
pmmapitests.AssertAPIErrorf(t, err, 400, codes.InvalidArgument,
`Invalid argument: data_retention: should be a natural number of days.`)
`invalid google.protobuf.Duration value "36h"`)
assert.Empty(t, res)
})

Expand Down Expand Up @@ -724,9 +724,9 @@ func TestSettings(t *testing.T) {
MetricsResolutions: &server.ChangeSettingsParamsBodyMetricsResolutions{
Hr: "2s",
Mr: "15s",
Lr: "2m",
Lr: "120s",
},
DataRetention: "240h",
DataRetention: "864000s", // 240h
AWSPartitions: []string{"aws-cn", "aws", "aws-cn"}, // duplicates are ok
},
Context: pmmapitests.Context,
Expand Down Expand Up @@ -791,8 +791,8 @@ func TestSettings(t *testing.T) {
res, err := serverClient.Default.Server.ChangeSettings(&server.ChangeSettingsParams{
Body: server.ChangeSettingsBody{
SttCheckIntervals: &server.ChangeSettingsParamsBodySttCheckIntervals{
RareInterval: "8h",
StandardInterval: "30m",
RareInterval: "28800s", // 8h
StandardInterval: "1800s", // 30m
FrequentInterval: "20s",
},
},
Expand Down Expand Up @@ -957,8 +957,8 @@ groups:
"60s": "60s",
"61s": "61s",
"61": "", // no suffix => error
"2m": "120s",
"1h": "3600s",
"2m": "", // m suffix => error
"1h": "", // h suffix => error
"1d": "", // d suffix => error
"1w": "", // w suffix => error
} {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ require (
github.com/minio/minio-go/v7 v7.0.21
github.com/percona-platform/dbaas-api v0.0.0-20220110092915-5aacd784d472
github.com/percona-platform/saas v0.0.0-20220310105301-9ab66b34782b
github.com/percona/pmm v0.0.0-20220310104949-dd33560bcdde
github.com/percona/pmm v0.0.0-20220314044734-70e6ebbedd4f
github.com/percona/promconfig v0.2.4-0.20211110115058-98687f586f54
github.com/pkg/errors v0.9.1
github.com/pmezard/go-difflib v1.0.0
Expand Down
7 changes: 7 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t
github.com/grpc-ecosystem/grpc-gateway v1.15.0/go.mod h1:vO11I9oWA+KsxmfFQPhLnnIb1VDE24M+pdxZFiuZcA8=
github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.2.0/go.mod h1:gRq9gZWcIFvz68EgWqy2qQpRbmtn5j2qLZ4zHjqiLpg=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.3 h1:I8MsauTJQXZ8df8qJvEln0kYNc3bSapuaSsEsnFdEFU=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.3/go.mod h1:lZdb/YAJUSj9OqrCHs2ihjtoO3+xK3G53wTYXFWRGDo=
github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
Expand Down Expand Up @@ -655,6 +656,8 @@ github.com/percona-platform/saas v0.0.0-20220310105301-9ab66b34782b h1:ElN+j11DV
github.com/percona-platform/saas v0.0.0-20220310105301-9ab66b34782b/go.mod h1:gFUwaFp6Ugu5qsBwiOVJYbDlzgZ77tmXdXGO7tG5xVI=
github.com/percona/pmm v0.0.0-20220310104949-dd33560bcdde h1:yla7hvLtr6ROQ0EwE3XzsHLMiIcrQ1OBKuaebchERsU=
github.com/percona/pmm v0.0.0-20220310104949-dd33560bcdde/go.mod h1:OmWayvQAavtvlzLkvpea5tAqaWGGNNyG+xj4MJUsNm4=
github.com/percona/pmm v0.0.0-20220314044734-70e6ebbedd4f h1:Pkf66CsxeulbUQ57/0lVykHUvpTWIXRhPuH1OtGWmjU=
github.com/percona/pmm v0.0.0-20220314044734-70e6ebbedd4f/go.mod h1:znPJjy09z8iE9Ipl/zJaK8d+qcaPyFqpt+RwEfM61GE=
github.com/percona/promconfig v0.2.1/go.mod h1:Y2uXi5QNk71+ceJHuI9poank+0S1kjxd3K105fXKVkg=
github.com/percona/promconfig v0.2.4-0.20211110115058-98687f586f54 h1:aI1emmycDTGWKsBdxFPKZqohfBbK4y2ta9G4+RX7gVg=
github.com/percona/promconfig v0.2.4-0.20211110115058-98687f586f54/go.mod h1:Y2uXi5QNk71+ceJHuI9poank+0S1kjxd3K105fXKVkg=
Expand Down Expand Up @@ -949,6 +952,7 @@ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4Iltr
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20210201163806-010130855d6c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 h1:RerP+noqYHUQ8CMRcPlC2nvTa4dcBIjegkuWdcUDuqg=
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
Expand Down Expand Up @@ -1172,6 +1176,7 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210207032614-bba0dbe2a9ea/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20220118154757-00ab72f36ad5/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350 h1:YxHp5zqIcAShDEvRr5/0rVESVS+njYF68PSdazrNLJo=
google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
Expand All @@ -1194,12 +1199,14 @@ google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg=
google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.0.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
Expand Down
4 changes: 0 additions & 4 deletions services/platform/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ type Service struct {
grafanaClient grafanaClient
}

func (s *Service) SearchOrganizationEntitlements(ctx context.Context, request *platformpb.SearchOrganizationEntitlementsRequest) (*platformpb.SearchOrganizationEntitlementsResponse, error) {
panic("implement me")
}

type grafanaClient interface {
GetCurrentUserAccessToken(ctx context.Context) (string, error)
}
Expand Down

0 comments on commit 1985d98

Please sign in to comment.