Skip to content

Commit

Permalink
Last small tweak, looks good otherwise!
Browse files Browse the repository at this point in the history
  • Loading branch information
svanharmelen committed Sep 10, 2021
1 parent 7a01d2f commit 8fd3da8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 19 deletions.
1 change: 0 additions & 1 deletion container_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ func TestGetRegistryRepositoryTagDetail(t *testing.T) {
t.Errorf("ContainerRegistry.GetRegistryRepositoryTagDetail returned error: %v", err)
}

timeLayout := "2006-01-02T15:04:05Z07:00"
createdAt, err := time.Parse(timeLayout, "2019-01-06T16:49:51.272+00:00")
if err != nil {
t.Errorf("ContainerRepository.ListRegistryRepositories error while parsing time: %v", err)
Expand Down
6 changes: 0 additions & 6 deletions deploy_keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func TestListAllDeployKeys(t *testing.T) {
t.Errorf("DeployKeys.ListAllDeployKeys returned error: %v", err)
}

timeLayout := "2006-01-02T15:04:05Z07:00"
createdAt, err := time.Parse(timeLayout, "2013-10-02T10:12:29Z")
if err != nil {
t.Errorf("DeployKeys.ListAllDeployKeys returned an error while parsing time: %v", err)
Expand Down Expand Up @@ -110,7 +109,6 @@ func TestListProjectDeployKeys(t *testing.T) {
t.Errorf("DeployKeys.ListProjectDeployKeys returned error: %v", err)
}

timeLayout := "2006-01-02T15:04:05Z07:00"
createdAt, err := time.Parse(timeLayout, "2013-10-02T10:12:29Z")
if err != nil {
t.Errorf("DeployKeys.ListAllDeployKeys returned an error while parsing time: %v", err)
Expand Down Expand Up @@ -162,7 +160,6 @@ func TestGetDeployKey(t *testing.T) {
t.Errorf("DeployKeys.GetDeployKey returned error: %v", err)
}

timeLayout := "2006-01-02T15:04:05Z07:00"
createdAt, err := time.Parse(timeLayout, "2013-10-02T10:12:29Z")
if err != nil {
t.Errorf("DeployKeys.ListAllDeployKeys returned an error while parsing time: %v", err)
Expand Down Expand Up @@ -205,7 +202,6 @@ func TestAddDeployKey(t *testing.T) {
t.Errorf("DeployKey.AddDeployKey returned error: %v", err)
}

timeLayout := "2006-01-02T15:04:05Z07:00"
createdAt, err := time.Parse(timeLayout, "2015-08-29T12:44:31.550Z")
if err != nil {
t.Errorf("DeployKeys.ListAllDeployKeys returned an error while parsing time: %v", err)
Expand Down Expand Up @@ -256,7 +252,6 @@ func TestEnableDeployKey(t *testing.T) {
t.Errorf("DeployKeys.EnableDeployKey returned error: %v", err)
}

timeLayout := "2006-01-02T15:04:05Z07:00"
createdAt, err := time.Parse(timeLayout, "2015-08-29T12:44:31.550Z")
if err != nil {
t.Errorf("DeployKeys.ListAllDeployKeys returned an error while parsing time: %v", err)
Expand Down Expand Up @@ -297,7 +292,6 @@ func TestUpdateDeployKey(t *testing.T) {
t.Errorf("DeployKeys.UpdateDeployKey returned error: %v", err)
}

timeLayout := "2006-01-02T15:04:05Z07:00"
createdAt, err := time.Parse(timeLayout, "2015-08-29T12:44:31.550Z")
if err != nil {
t.Errorf("DeployKeys.ListAllDeployKeys returned an error while parsing time: %v", err)
Expand Down
2 changes: 2 additions & 0 deletions gitlab_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import (
retryablehttp "github.com/hashicorp/go-retryablehttp"
)

var timeLayout = "2006-01-02T15:04:05Z07:00"

// setup sets up a test HTTP server along with a gitlab.Client that is
// configured to talk to that test server. Tests should register handlers on
// mux which provide mock responses for the API method being tested.
Expand Down
20 changes: 8 additions & 12 deletions group_clusters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestGroupListClusters(t *testing.T) {
{
"api_url":"https://104.197.68.152",
"authorization_type":"rbac",
"ca_cert":"-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----"
"ca_cert":"-----BEGIN CERTIFICATE-----\r\nAAAAA\r\n-----END CERTIFICATE-----"
},
"management_project":
{
Expand All @@ -80,7 +80,6 @@ func TestGroupListClusters(t *testing.T) {
t.Errorf("GroupCluster.ListClusters returned error: %v", err)
}

timeLayout := "2006-01-02T15:04:05Z07:00"
createdAt, err := time.Parse(timeLayout, "2019-01-02T20:18:12.563Z")
if err != nil {
t.Errorf("DeployKeys.ListAllDeployKeys returned an error while parsing time: %v", err)
Expand Down Expand Up @@ -114,7 +113,7 @@ func TestGroupListClusters(t *testing.T) {
PlatformKubernetes: &PlatformKubernetes{
APIURL: "https://104.197.68.152",
AuthorizationType: "rbac",
CaCert: "-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----",
CaCert: "-----BEGIN CERTIFICATE-----\r\nAAAAA\r\n-----END CERTIFICATE-----",
},
ManagementProject: &ManagementProject{
ID: 2,
Expand Down Expand Up @@ -166,7 +165,7 @@ func TestGetGroupCluster(t *testing.T) {
{
"api_url":"https://104.197.68.152",
"authorization_type":"rbac",
"ca_cert":"-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----"
"ca_cert":"-----BEGIN CERTIFICATE-----\r\nAAAAA\r\n-----END CERTIFICATE-----"
},
"management_project":
{
Expand All @@ -192,7 +191,6 @@ func TestGetGroupCluster(t *testing.T) {
t.Errorf("GroupCluster.GetCluster returned error: %v", err)
}

timeLayout := "2006-01-02T15:04:05Z07:00"
createdAt, err := time.Parse(timeLayout, "2019-01-02T20:18:12.563Z")
if err != nil {
t.Errorf("DeployKeys.ListAllDeployKeys returned an error while parsing time: %v", err)
Expand Down Expand Up @@ -225,7 +223,7 @@ func TestGetGroupCluster(t *testing.T) {
PlatformKubernetes: &PlatformKubernetes{
APIURL: "https://104.197.68.152",
AuthorizationType: "rbac",
CaCert: "-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----",
CaCert: "-----BEGIN CERTIFICATE-----\r\nAAAAA\r\n-----END CERTIFICATE-----",
},
ManagementProject: &ManagementProject{
ID: 2,
Expand Down Expand Up @@ -276,7 +274,7 @@ func TestAddGroupCluster(t *testing.T) {
{
"api_url":"https://35.111.51.20",
"authorization_type":"rbac",
"ca_cert":"-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----"
"ca_cert":"-----BEGIN CERTIFICATE-----\r\nAAAAA\r\n-----END CERTIFICATE-----"
},
"management_project":null,
"group":
Expand All @@ -293,7 +291,6 @@ func TestAddGroupCluster(t *testing.T) {
t.Errorf("GroupCluster.AddCluster returned error: %v", err)
}

timeLayout := "2006-01-02T15:04:05Z07:00"
createdAt, err := time.Parse(timeLayout, "2019-01-03T21:53:40.610Z")
if err != nil {
t.Errorf("DeployKeys.ListAllDeployKeys returned an error while parsing time: %v", err)
Expand All @@ -320,7 +317,7 @@ func TestAddGroupCluster(t *testing.T) {
PlatformKubernetes: &PlatformKubernetes{
APIURL: "https://35.111.51.20",
AuthorizationType: "rbac",
CaCert: "-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----",
CaCert: "-----BEGIN CERTIFICATE-----\r\nAAAAA\r\n-----END CERTIFICATE-----",
},
ManagementProject: nil,
Group: &Group{
Expand Down Expand Up @@ -387,21 +384,20 @@ func TestEditGroupCluster(t *testing.T) {
name := "new-cluster-name"
domain := "new-domain.com"
enviromentScope := "*"
apiUrl := "https://new-api-url.com"
apiURL := "https://new-api-url.com"
opt := &EditGroupClusterOptions{
Name: &name,
Domain: &domain,
EnvironmentScope: &enviromentScope,
PlatformKubernetes: &EditGroupPlatformKubernetesOptions{
APIURL: &apiUrl,
APIURL: &apiURL,
},
}
cluster, _, err := client.GroupCluster.EditCluster(26, 24, opt)
if err != nil {
t.Errorf("GroupCluster.EditCluster returned error: %v", err)
}

timeLayout := "2006-01-02T15:04:05Z07:00"
createdAt, err := time.Parse(timeLayout, "2019-01-03T21:53:40.610Z")
if err != nil {
t.Errorf("DeployKeys.ListAllDeployKeys returned an error while parsing time: %v", err)
Expand Down

0 comments on commit 8fd3da8

Please sign in to comment.