diff --git a/.golangci.yml b/.golangci.yml index 3ac122752..28e5abb8a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -73,11 +73,15 @@ linters: - builtin$ - examples$ formatters: + settings: + golines: + max-len: 160 enable: - gci - gofmt - gofumpt - goimports + - golines exclusions: generated: lax paths: diff --git a/monitor_services_create_token.go b/monitor_services_create_token.go index cb5ca12c4..a5cb47ae9 100644 --- a/monitor_services_create_token.go +++ b/monitor_services_create_token.go @@ -16,7 +16,11 @@ type MonitorTokenCreateOptions struct { } // CreateMonitorServiceTokenForServiceType to create token for a given serviceType -func (c *Client) CreateMonitorServiceTokenForServiceType(ctx context.Context, serviceType string, opts MonitorTokenCreateOptions) (*MonitorServiceToken, error) { +func (c *Client) CreateMonitorServiceTokenForServiceType( + ctx context.Context, + serviceType string, + opts MonitorTokenCreateOptions, +) (*MonitorServiceToken, error) { e := formatAPIPath("monitor/services/%s/token", serviceType) return doPOSTRequest[MonitorServiceToken](ctx, c, e, opts) } diff --git a/nodebalancer_config_nodes.go b/nodebalancer_config_nodes.go index dcffb9e45..6516ba717 100644 --- a/nodebalancer_config_nodes.go +++ b/nodebalancer_config_nodes.go @@ -90,7 +90,13 @@ func (c *Client) CreateNodeBalancerNode(ctx context.Context, nodebalancerID int, } // UpdateNodeBalancerNode updates the NodeBalancerNode with the specified id -func (c *Client) UpdateNodeBalancerNode(ctx context.Context, nodebalancerID int, configID int, nodeID int, opts NodeBalancerNodeUpdateOptions) (*NodeBalancerNode, error) { +func (c *Client) UpdateNodeBalancerNode( + ctx context.Context, + nodebalancerID int, + configID int, + nodeID int, + opts NodeBalancerNodeUpdateOptions, +) (*NodeBalancerNode, error) { e := formatAPIPath("nodebalancers/%d/configs/%d/nodes/%d", nodebalancerID, configID, nodeID) return doPUTRequest[NodeBalancerNode](ctx, c, e, opts) } diff --git a/nodebalancer_configs.go b/nodebalancer_configs.go index eb5f2fc61..2c532837b 100644 --- a/nodebalancer_configs.go +++ b/nodebalancer_configs.go @@ -264,7 +264,12 @@ func (c *Client) CreateNodeBalancerConfig(ctx context.Context, nodebalancerID in } // UpdateNodeBalancerConfig updates the NodeBalancerConfig with the specified id -func (c *Client) UpdateNodeBalancerConfig(ctx context.Context, nodebalancerID int, configID int, opts NodeBalancerConfigUpdateOptions) (*NodeBalancerConfig, error) { +func (c *Client) UpdateNodeBalancerConfig( + ctx context.Context, + nodebalancerID int, + configID int, + opts NodeBalancerConfigUpdateOptions, +) (*NodeBalancerConfig, error) { e := formatAPIPath("nodebalancers/%d/configs/%d", nodebalancerID, configID) return doPUTRequest[NodeBalancerConfig](ctx, c, e, opts) } @@ -276,7 +281,12 @@ func (c *Client) DeleteNodeBalancerConfig(ctx context.Context, nodebalancerID in } // RebuildNodeBalancerConfig updates the NodeBalancer with the specified id -func (c *Client) RebuildNodeBalancerConfig(ctx context.Context, nodeBalancerID int, configID int, opts NodeBalancerConfigRebuildOptions) (*NodeBalancerConfig, error) { +func (c *Client) RebuildNodeBalancerConfig( + ctx context.Context, + nodeBalancerID int, + configID int, + opts NodeBalancerConfigRebuildOptions, +) (*NodeBalancerConfig, error) { e := formatAPIPath("nodebalancers/%d/configs/%d/rebuild", nodeBalancerID, configID) return doPOSTRequest[NodeBalancerConfig](ctx, c, e, opts) } diff --git a/object_storage_bucket_certs.go b/object_storage_bucket_certs.go index 244aa1544..6597e40f5 100644 --- a/object_storage_bucket_certs.go +++ b/object_storage_bucket_certs.go @@ -20,7 +20,11 @@ type ObjectStorageBucketCertUploadOptions struct { // UploadObjectStorageBucketCert uploads a TLS/SSL Cert to be used with an Object Storage Bucket. // Deprecated: Please use UploadObjectStorageBucketCertV2 for all new implementations. -func (c *Client) UploadObjectStorageBucketCert(ctx context.Context, clusterOrRegionID, bucket string, opts ObjectStorageBucketCertUploadOptions) (*ObjectStorageBucketCert, error) { +func (c *Client) UploadObjectStorageBucketCert( + ctx context.Context, + clusterOrRegionID, bucket string, + opts ObjectStorageBucketCertUploadOptions, +) (*ObjectStorageBucketCert, error) { e := formatAPIPath("object-storage/buckets/%s/%s/ssl", clusterOrRegionID, bucket) return doPOSTRequest[ObjectStorageBucketCert](ctx, c, e, opts) } @@ -33,7 +37,11 @@ func (c *Client) GetObjectStorageBucketCert(ctx context.Context, clusterOrRegion } // UploadObjectStorageBucketCert uploads a TLS/SSL Cert to be used with an Object Storage Bucket. -func (c *Client) UploadObjectStorageBucketCertV2(ctx context.Context, clusterOrRegionID, bucket string, opts ObjectStorageBucketCertUploadOptions) (*ObjectStorageBucketCertV2, error) { +func (c *Client) UploadObjectStorageBucketCertV2( + ctx context.Context, + clusterOrRegionID, bucket string, + opts ObjectStorageBucketCertUploadOptions, +) (*ObjectStorageBucketCertV2, error) { e := formatAPIPath("object-storage/buckets/%s/%s/ssl", clusterOrRegionID, bucket) return doPOSTRequest[ObjectStorageBucketCertV2](ctx, c, e, opts) } diff --git a/object_storage_buckets.go b/object_storage_buckets.go index d520408ba..8755f3ade 100644 --- a/object_storage_buckets.go +++ b/object_storage_buckets.go @@ -172,7 +172,11 @@ func (c *Client) DeleteObjectStorageBucket(ctx context.Context, clusterOrRegionI } // Lists the contents of the specified ObjectStorageBucket -func (c *Client) ListObjectStorageBucketContents(ctx context.Context, clusterOrRegionID, label string, params *ObjectStorageBucketListContentsParams) (*ObjectStorageBucketContent, error) { +func (c *Client) ListObjectStorageBucketContents( + ctx context.Context, + clusterOrRegionID, label string, + params *ObjectStorageBucketListContentsParams, +) (*ObjectStorageBucketContent, error) { basePath := formatAPIPath("object-storage/buckets/%s/%s/object-list", clusterOrRegionID, label) queryString := "" diff --git a/object_storage_object.go b/object_storage_object.go index 61fd93e14..2e9cf8890 100644 --- a/object_storage_object.go +++ b/object_storage_object.go @@ -33,7 +33,11 @@ type ObjectStorageObjectACLConfigUpdateOptions struct { ACL string `json:"acl"` } -func (c *Client) CreateObjectStorageObjectURL(ctx context.Context, objectID, label string, opts ObjectStorageObjectURLCreateOptions) (*ObjectStorageObjectURL, error) { +func (c *Client) CreateObjectStorageObjectURL( + ctx context.Context, + objectID, label string, + opts ObjectStorageObjectURLCreateOptions, +) (*ObjectStorageObjectURL, error) { e := formatAPIPath("object-storage/buckets/%s/%s/object-url", objectID, label) return doPOSTRequest[ObjectStorageObjectURL](ctx, c, e, opts) } @@ -45,7 +49,11 @@ func (c *Client) GetObjectStorageObjectACLConfig(ctx context.Context, objectID, } // Deprecated: use UpdateObjectStorageObjectACLConfigV2 for new implementations -func (c *Client) UpdateObjectStorageObjectACLConfig(ctx context.Context, objectID, label string, opts ObjectStorageObjectACLConfigUpdateOptions) (*ObjectStorageObjectACLConfig, error) { +func (c *Client) UpdateObjectStorageObjectACLConfig( + ctx context.Context, + objectID, label string, + opts ObjectStorageObjectACLConfigUpdateOptions, +) (*ObjectStorageObjectACLConfig, error) { e := formatAPIPath("object-storage/buckets/%s/%s/object-acl", objectID, label) return doPUTRequest[ObjectStorageObjectACLConfig](ctx, c, e, opts) } @@ -55,7 +63,11 @@ func (c *Client) GetObjectStorageObjectACLConfigV2(ctx context.Context, objectID return doGETRequest[ObjectStorageObjectACLConfigV2](ctx, c, e) } -func (c *Client) UpdateObjectStorageObjectACLConfigV2(ctx context.Context, objectID, label string, opts ObjectStorageObjectACLConfigUpdateOptions) (*ObjectStorageObjectACLConfigV2, error) { +func (c *Client) UpdateObjectStorageObjectACLConfigV2( + ctx context.Context, + objectID, label string, + opts ObjectStorageObjectACLConfigUpdateOptions, +) (*ObjectStorageObjectACLConfigV2, error) { e := formatAPIPath("object-storage/buckets/%s/%s/object-acl", objectID, label) return doPUTRequest[ObjectStorageObjectACLConfigV2](ctx, c, e, opts) } diff --git a/request_helpers_test.go b/request_helpers_test.go index bed2e7403..ce4bf80b5 100644 --- a/request_helpers_test.go +++ b/request_helpers_test.go @@ -9,12 +9,10 @@ import ( "strconv" "testing" - "github.com/stretchr/testify/require" - - "github.com/linode/linodego/internal/testutil" - "github.com/google/go-cmp/cmp" "github.com/jarcoal/httpmock" + "github.com/linode/linodego/internal/testutil" + "github.com/stretchr/testify/require" ) type testResultNestedType struct { diff --git a/test/integration/account_oauth_client_test.go b/test/integration/account_oauth_client_test.go index 1aa951b09..538210584 100644 --- a/test/integration/account_oauth_client_test.go +++ b/test/integration/account_oauth_client_test.go @@ -4,10 +4,9 @@ import ( "context" "testing" - "github.com/stretchr/testify/assert" - "github.com/linode/linodego" . "github.com/linode/linodego" + "github.com/stretchr/testify/assert" ) func TestOAuthClient_GetMissing(t *testing.T) { @@ -89,7 +88,11 @@ func TestOAuthClients_Reset(t *testing.T) { assert.NotEqual(t, oauthClient.Secret, oauthClientAfterReset.Secret, "Secret should have been reset") } -func setupOAuthClient(t *testing.T, createOpts linodego.OAuthClientCreateOptions, fixturesYaml string) (*linodego.Client, *linodego.OAuthClient, func(), error) { +func setupOAuthClient( + t *testing.T, + createOpts linodego.OAuthClientCreateOptions, + fixturesYaml string, +) (*linodego.Client, *linodego.OAuthClient, func(), error) { t.Helper() client, fixtureTeardown := createTestClient(t, fixturesYaml) oauthClient, err := client.CreateOAuthClient(context.Background(), createOpts) diff --git a/test/integration/images_test.go b/test/integration/images_test.go index 572fdd3d5..8abb13c75 100644 --- a/test/integration/images_test.go +++ b/test/integration/images_test.go @@ -6,11 +6,10 @@ import ( "slices" "testing" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/dnaeon/go-vcr/recorder" . "github.com/linode/linodego" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) // testImageBytes is a minimal Gzipped image. diff --git a/test/integration/instance_firewalls_test.go b/test/integration/instance_firewalls_test.go index c3746213c..ff8728670 100644 --- a/test/integration/instance_firewalls_test.go +++ b/test/integration/instance_firewalls_test.go @@ -27,7 +27,11 @@ func TestInstanceFirewalls_List(t *testing.T) { } } -func setupInstanceFirewall(t *testing.T, firewallModifiers []firewallModifier, fixturesYaml string) (*linodego.Client, *linodego.Instance, *linodego.Firewall, error) { +func setupInstanceFirewall( + t *testing.T, + firewallModifiers []firewallModifier, + fixturesYaml string, +) (*linodego.Client, *linodego.Instance, *linodego.Firewall, error) { t.Helper() client, firewall, firewallTeardown, err := setupFirewall(t, firewallModifiers, fixturesYaml) diff --git a/test/integration/instances_test.go b/test/integration/instances_test.go index b12d1270c..490bb0afa 100644 --- a/test/integration/instances_test.go +++ b/test/integration/instances_test.go @@ -353,9 +353,14 @@ func TestInstance_Disks_List(t *testing.T) { } func TestInstance_Disks_List_WithEncryption(t *testing.T) { - client, instance, teardown, err := setupInstance(t, "fixtures/TestInstance_Disks_List_WithEncryption", true, func(c *linodego.Client, ico *linodego.InstanceCreateOptions) { - ico.Region = getRegionsWithCaps(t, c, []string{"Disk Encryption"})[0] - }) + client, instance, teardown, err := setupInstance( + t, + "fixtures/TestInstance_Disks_List_WithEncryption", + true, + func(c *linodego.Client, ico *linodego.InstanceCreateOptions) { + ico.Region = getRegionsWithCaps(t, c, []string{"Disk Encryption"})[0] + }, + ) defer teardown() if err != nil { t.Error(err) @@ -941,7 +946,12 @@ func createInstance(t *testing.T, client *linodego.Client, enableCloudFirewall b return client.CreateInstance(context.Background(), createOpts) } -func setupInstance(t *testing.T, fixturesYaml string, EnableCloudFirewall bool, modifiers ...instanceModifier) (*linodego.Client, *linodego.Instance, func(), error) { +func setupInstance( + t *testing.T, + fixturesYaml string, + EnableCloudFirewall bool, + modifiers ...instanceModifier, +) (*linodego.Client, *linodego.Instance, func(), error) { if t != nil { t.Helper() } @@ -1008,7 +1018,12 @@ func createInstanceWithoutDisks( return instance, config, teardown, err } -func setupInstanceWithoutDisks(t *testing.T, fixturesYaml string, enableCloudFirewall bool, modifiers ...instanceModifier) (*linodego.Client, *linodego.Instance, *linodego.InstanceConfig, func(), error) { +func setupInstanceWithoutDisks( + t *testing.T, + fixturesYaml string, + enableCloudFirewall bool, + modifiers ...instanceModifier, +) (*linodego.Client, *linodego.Instance, *linodego.InstanceConfig, func(), error) { t.Helper() client, fixtureTeardown := createTestClient(t, fixturesYaml) instance, config, instanceTeardown, err := createInstanceWithoutDisks(t, client, enableCloudFirewall, modifiers...) diff --git a/test/integration/integration_suite_test.go b/test/integration/integration_suite_test.go index 2bad132e3..04dc16710 100644 --- a/test/integration/integration_suite_test.go +++ b/test/integration/integration_suite_test.go @@ -13,11 +13,10 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - "github.com/dnaeon/go-vcr/cassette" "github.com/dnaeon/go-vcr/recorder" "github.com/linode/linodego" + "github.com/stretchr/testify/require" "golang.org/x/oauth2" "k8s.io/client-go/transport" ) diff --git a/test/integration/lke_clusters_acl_test.go b/test/integration/lke_clusters_acl_test.go index e31f903b0..56cc254fd 100644 --- a/test/integration/lke_clusters_acl_test.go +++ b/test/integration/lke_clusters_acl_test.go @@ -4,10 +4,9 @@ import ( "context" "testing" + "github.com/linode/linodego" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - - "github.com/linode/linodego" ) func TestLKECluster_withACL(t *testing.T) { diff --git a/test/integration/lke_node_pools_test.go b/test/integration/lke_node_pools_test.go index d792f2677..659dc9bc2 100644 --- a/test/integration/lke_node_pools_test.go +++ b/test/integration/lke_node_pools_test.go @@ -4,10 +4,9 @@ import ( "context" "testing" - k8scondition "github.com/linode/linodego/k8s/pkg/condition" - "github.com/google/go-cmp/cmp" "github.com/linode/linodego" + k8scondition "github.com/linode/linodego/k8s/pkg/condition" ) var testLKENodePoolCreateOpts = linodego.LKENodePoolCreateOptions{ @@ -288,7 +287,11 @@ func TestLKENodePool_CreateWithLabelsAndTaints(t *testing.T) { } } -func setupLKENodePool(t *testing.T, fixturesYaml string, nodePoolCreateOpts *linodego.LKENodePoolCreateOptions) (*linodego.Client, *linodego.LKECluster, *linodego.LKENodePool, func(), error) { +func setupLKENodePool( + t *testing.T, + fixturesYaml string, + nodePoolCreateOpts *linodego.LKENodePoolCreateOptions, +) (*linodego.Client, *linodego.LKECluster, *linodego.LKENodePool, func(), error) { t.Helper() var fixtureTeardown func() client, lkeCluster, fixtureTeardown, err := setupLKECluster(t, []clusterModifier{func(createOpts *linodego.LKEClusterCreateOptions) { @@ -359,7 +362,11 @@ func TestLKEEnterpriseNodePoolK8sUpgrade_Update(t *testing.T) { } } -func setupLKEEnterpriseNodePool(t *testing.T, fixturesYaml string, nodePoolCreateOpts *linodego.LKENodePoolCreateOptions) (*linodego.Client, *linodego.LKECluster, *linodego.LKENodePool, func(), error) { +func setupLKEEnterpriseNodePool( + t *testing.T, + fixturesYaml string, + nodePoolCreateOpts *linodego.LKENodePoolCreateOptions, +) (*linodego.Client, *linodego.LKECluster, *linodego.LKENodePool, func(), error) { t.Helper() var fixtureTeardown func() client, lkeCluster, fixtureTeardown, err := setupLKECluster(t, []clusterModifier{func(createOpts *linodego.LKEClusterCreateOptions) { diff --git a/test/integration/monitor_metrics_definitions_test.go b/test/integration/monitor_metrics_definitions_test.go index e517789b5..76893b447 100644 --- a/test/integration/monitor_metrics_definitions_test.go +++ b/test/integration/monitor_metrics_definitions_test.go @@ -23,7 +23,11 @@ func TestMonitorMetricDefinitions_Get_smoke(t *testing.T) { } // Get the metric-definitions by serviceType for the filter "is_alertable":false - monitorMetricDefinitionsClientListFilter, listErr := client.ListMonitorMetricsDefinitionByServiceType(context.Background(), "dbaas", linodego.NewListOptions(0, "{\"is_alertable\":false}")) + monitorMetricDefinitionsClientListFilter, listErr := client.ListMonitorMetricsDefinitionByServiceType( + context.Background(), + "dbaas", + linodego.NewListOptions(0, "{\"is_alertable\":false}"), + ) if listErr != nil { t.Errorf("Error listing monitor metrics:%s", listErr) } diff --git a/test/integration/mysql_db_config_test.go b/test/integration/mysql_db_config_test.go index 3f2e7495d..9ad8f3052 100644 --- a/test/integration/mysql_db_config_test.go +++ b/test/integration/mysql_db_config_test.go @@ -27,8 +27,11 @@ func TestDatabaseMySQL_EngineConfig_Get(t *testing.T) { assert.IsType(t, bool(false), config.MySQL.ConnectTimeout.RequiresRestart) assert.Equal(t, "integer", config.MySQL.ConnectTimeout.Type) - assert.IsType(t, string("Default server time zone as an offset from UTC (from -12:00 to +12:00), a time zone name, or 'SYSTEM' to use the MySQL server default."), - config.MySQL.DefaultTimeZone.Description) + assert.IsType( + t, + string("Default server time zone as an offset from UTC (from -12:00 to +12:00), a time zone name, or 'SYSTEM' to use the MySQL server default."), + config.MySQL.DefaultTimeZone.Description, + ) assert.IsType(t, string("+03:00"), config.MySQL.DefaultTimeZone.Example) assert.IsType(t, int(100), config.MySQL.DefaultTimeZone.MaxLength) assert.IsType(t, int(2), config.MySQL.DefaultTimeZone.MinLength) @@ -50,82 +53,134 @@ func TestDatabaseMySQL_EngineConfig_Get(t *testing.T) { assert.IsType(t, bool(false), config.MySQL.InformationSchemaStatsExpiry.RequiresRestart) assert.Equal(t, "integer", config.MySQL.InformationSchemaStatsExpiry.Type) - assert.IsType(t, string("Maximum size for the InnoDB change buffer, as a percentage of the total size of the buffer pool. Default is 25"), config.MySQL.InnoDBChangeBufferMaxSize.Description) + assert.IsType( + t, + string("Maximum size for the InnoDB change buffer, as a percentage of the total size of the buffer pool. Default is 25"), + config.MySQL.InnoDBChangeBufferMaxSize.Description, + ) assert.IsType(t, int(30), config.MySQL.InnoDBChangeBufferMaxSize.Example) assert.IsType(t, int(50), config.MySQL.InnoDBChangeBufferMaxSize.Maximum) assert.IsType(t, int(0), config.MySQL.InnoDBChangeBufferMaxSize.Minimum) assert.IsType(t, bool(false), config.MySQL.InnoDBChangeBufferMaxSize.RequiresRestart) assert.Equal(t, "integer", config.MySQL.InnoDBChangeBufferMaxSize.Type) - assert.IsType(t, string("Specifies whether flushing a page from the InnoDB buffer pool also flushes other dirty pages in the same extent (default is 1): 0 - dirty pages in the same extent are not flushed, 1 - flush contiguous dirty pages in the same extent, 2 - flush dirty pages in the same extent"), config.MySQL.InnoDBFlushNeighbors.Description) + assert.IsType( + t, + string( + "Specifies whether flushing a page from the InnoDB buffer pool also flushes other dirty pages in the same extent (default is 1): 0 - dirty pages in the same extent are not flushed, 1 - flush contiguous dirty pages in the same extent, 2 - flush dirty pages in the same extent", + ), + config.MySQL.InnoDBFlushNeighbors.Description, + ) assert.IsType(t, int(0), config.MySQL.InnoDBFlushNeighbors.Example) assert.IsType(t, int(2), config.MySQL.InnoDBFlushNeighbors.Maximum) assert.IsType(t, int(0), config.MySQL.InnoDBFlushNeighbors.Minimum) assert.IsType(t, bool(false), config.MySQL.InnoDBFlushNeighbors.RequiresRestart) assert.Equal(t, "integer", config.MySQL.InnoDBFlushNeighbors.Type) - assert.IsType(t, string("Minimum length of words that are stored in an InnoDB FULLTEXT index. Changing this parameter will lead to a restart of the MySQL service."), config.MySQL.InnoDBFTMinTokenSize.Description) + assert.IsType( + t, + string("Minimum length of words that are stored in an InnoDB FULLTEXT index. Changing this parameter will lead to a restart of the MySQL service."), + config.MySQL.InnoDBFTMinTokenSize.Description, + ) assert.IsType(t, int(3), config.MySQL.InnoDBFTMinTokenSize.Example) assert.IsType(t, int(16), config.MySQL.InnoDBFTMinTokenSize.Maximum) assert.IsType(t, int(0), config.MySQL.InnoDBFTMinTokenSize.Minimum) assert.IsType(t, bool(true), config.MySQL.InnoDBFTMinTokenSize.RequiresRestart) assert.Equal(t, "integer", config.MySQL.InnoDBFTMinTokenSize.Type) - assert.IsType(t, string("This option is used to specify your own InnoDB FULLTEXT index stopword list for all InnoDB tables."), config.MySQL.InnoDBFTServerStopwordTable.Description) + assert.IsType( + t, + string("This option is used to specify your own InnoDB FULLTEXT index stopword list for all InnoDB tables."), + config.MySQL.InnoDBFTServerStopwordTable.Description, + ) assert.IsType(t, string("db_name/table_name"), config.MySQL.InnoDBFTServerStopwordTable.Example) assert.IsType(t, int(1024), config.MySQL.InnoDBFTServerStopwordTable.MaxLength) assert.IsType(t, string("^.+/.+$"), config.MySQL.InnoDBFTServerStopwordTable.Pattern) assert.IsType(t, bool(false), config.MySQL.InnoDBFTServerStopwordTable.RequiresRestart) assert.Equal(t, []string{"null", "string"}, config.MySQL.InnoDBFTServerStopwordTable.Type) - assert.IsType(t, string("The length of time in seconds an InnoDB transaction waits for a row lock before giving up. Default is 120."), config.MySQL.InnoDBLockWaitTimeout.Description) + assert.IsType( + t, + string("The length of time in seconds an InnoDB transaction waits for a row lock before giving up. Default is 120."), + config.MySQL.InnoDBLockWaitTimeout.Description, + ) assert.IsType(t, int(50), config.MySQL.InnoDBLockWaitTimeout.Example) assert.IsType(t, int(3600), config.MySQL.InnoDBLockWaitTimeout.Maximum) assert.IsType(t, int(1), config.MySQL.InnoDBLockWaitTimeout.Minimum) assert.IsType(t, bool(false), config.MySQL.InnoDBLockWaitTimeout.RequiresRestart) assert.Equal(t, "integer", config.MySQL.InnoDBLockWaitTimeout.Type) - assert.IsType(t, string("The size in bytes of the buffer that InnoDB uses to write to the log files on disk."), config.MySQL.InnoDBLogBufferSize.Description) + assert.IsType( + t, + string("The size in bytes of the buffer that InnoDB uses to write to the log files on disk."), + config.MySQL.InnoDBLogBufferSize.Description, + ) assert.IsType(t, int(16777216), config.MySQL.InnoDBLogBufferSize.Example) assert.IsType(t, int(4294967295), config.MySQL.InnoDBLogBufferSize.Maximum) assert.IsType(t, int(1048576), config.MySQL.InnoDBLogBufferSize.Minimum) assert.IsType(t, bool(false), config.MySQL.InnoDBLogBufferSize.RequiresRestart) assert.Equal(t, "integer", config.MySQL.InnoDBLogBufferSize.Type) - assert.IsType(t, string("The upper limit in bytes on the size of the temporary log files used during online DDL operations for InnoDB tables."), config.MySQL.InnoDBOnlineAlterLogMaxSize.Description) + assert.IsType( + t, + string("The upper limit in bytes on the size of the temporary log files used during online DDL operations for InnoDB tables."), + config.MySQL.InnoDBOnlineAlterLogMaxSize.Description, + ) assert.IsType(t, int(134217728), config.MySQL.InnoDBOnlineAlterLogMaxSize.Example) assert.IsType(t, int(1099511627776), config.MySQL.InnoDBOnlineAlterLogMaxSize.Maximum) assert.IsType(t, int(65536), config.MySQL.InnoDBOnlineAlterLogMaxSize.Minimum) assert.IsType(t, bool(false), config.MySQL.InnoDBOnlineAlterLogMaxSize.RequiresRestart) assert.Equal(t, "integer", config.MySQL.InnoDBOnlineAlterLogMaxSize.Type) - assert.IsType(t, string("The number of I/O threads for read operations in InnoDB. Default is 4. Changing this parameter will lead to a restart of the MySQL service."), config.MySQL.InnoDBReadIOThreads.Description) + assert.IsType( + t, + string("The number of I/O threads for read operations in InnoDB. Default is 4. Changing this parameter will lead to a restart of the MySQL service."), + config.MySQL.InnoDBReadIOThreads.Description, + ) assert.IsType(t, int(10), config.MySQL.InnoDBReadIOThreads.Example) assert.IsType(t, int(64), config.MySQL.InnoDBReadIOThreads.Maximum) assert.IsType(t, int(1), config.MySQL.InnoDBReadIOThreads.Minimum) assert.IsType(t, bool(true), config.MySQL.InnoDBReadIOThreads.RequiresRestart) assert.Equal(t, "integer", config.MySQL.InnoDBReadIOThreads.Type) - assert.IsType(t, string("When enabled a transaction timeout causes InnoDB to abort and roll back the entire transaction. Changing this parameter will lead to a restart of the MySQL service."), config.MySQL.InnoDBRollbackOnTimeout.Description) + assert.IsType( + t, + string( + "When enabled a transaction timeout causes InnoDB to abort and roll back the entire transaction. Changing this parameter will lead to a restart of the MySQL service.", + ), + config.MySQL.InnoDBRollbackOnTimeout.Description, + ) assert.IsType(t, bool(true), config.MySQL.InnoDBRollbackOnTimeout.Example) assert.IsType(t, bool(true), config.MySQL.InnoDBRollbackOnTimeout.RequiresRestart) assert.Equal(t, "boolean", config.MySQL.InnoDBRollbackOnTimeout.Type) - assert.IsType(t, string("Defines the maximum number of threads permitted inside of InnoDB. Default is 0 (infinite concurrency - no limit)"), config.MySQL.InnoDBThreadConcurrency.Description) + assert.IsType( + t, + string("Defines the maximum number of threads permitted inside of InnoDB. Default is 0 (infinite concurrency - no limit)"), + config.MySQL.InnoDBThreadConcurrency.Description, + ) assert.IsType(t, int(10), config.MySQL.InnoDBThreadConcurrency.Example) assert.IsType(t, int(1000), config.MySQL.InnoDBThreadConcurrency.Maximum) assert.IsType(t, int(0), config.MySQL.InnoDBThreadConcurrency.Minimum) assert.IsType(t, bool(false), config.MySQL.InnoDBThreadConcurrency.RequiresRestart) assert.Equal(t, "integer", config.MySQL.InnoDBThreadConcurrency.Type) - assert.IsType(t, string("The number of I/O threads for write operations in InnoDB. Default is 4. Changing this parameter will lead to a restart of the MySQL service."), config.MySQL.InnoDBWriteIOThreads.Description) + assert.IsType( + t, + string("The number of I/O threads for write operations in InnoDB. Default is 4. Changing this parameter will lead to a restart of the MySQL service."), + config.MySQL.InnoDBWriteIOThreads.Description, + ) assert.IsType(t, int(10), config.MySQL.InnoDBWriteIOThreads.Example) assert.IsType(t, int(64), config.MySQL.InnoDBWriteIOThreads.Maximum) assert.IsType(t, int(1), config.MySQL.InnoDBWriteIOThreads.Minimum) assert.IsType(t, bool(true), config.MySQL.InnoDBWriteIOThreads.RequiresRestart) assert.Equal(t, "integer", config.MySQL.InnoDBWriteIOThreads.Type) - assert.IsType(t, string("The number of seconds the server waits for activity on an interactive connection before closing it."), config.MySQL.InteractiveTimeout.Description) + assert.IsType( + t, + string("The number of seconds the server waits for activity on an interactive connection before closing it."), + config.MySQL.InteractiveTimeout.Description, + ) assert.IsType(t, int(3600), config.MySQL.InteractiveTimeout.Example) assert.IsType(t, int(604800), config.MySQL.InteractiveTimeout.Maximum) assert.IsType(t, int(30), config.MySQL.InteractiveTimeout.Minimum) diff --git a/test/integration/network_ips_test.go b/test/integration/network_ips_test.go index 545b4a492..fef3d2f4b 100644 --- a/test/integration/network_ips_test.go +++ b/test/integration/network_ips_test.go @@ -6,10 +6,9 @@ import ( "strings" "testing" - "github.com/stretchr/testify/require" - "github.com/linode/linodego" . "github.com/linode/linodego" + "github.com/stretchr/testify/require" ) func TestIPAddress_GetMissing(t *testing.T) { diff --git a/test/integration/network_reserved_ips_test.go b/test/integration/network_reserved_ips_test.go index c261a0ba3..9316fd8b8 100644 --- a/test/integration/network_reserved_ips_test.go +++ b/test/integration/network_reserved_ips_test.go @@ -82,7 +82,10 @@ func TestReservedIPAddresses_EndToEndTest(t *testing.T) { }) if resErr != nil { - t.Fatalf("Failed to reserve IP. This test expects the user to have 0 prior reservations and the ip_reservation_limit to be 2. Error from the API: %v", resErr) + t.Fatalf( + "Failed to reserve IP. This test expects the user to have 0 prior reservations and the ip_reservation_limit to be 2. Error from the API: %v", + resErr, + ) } t.Logf("Successfully reserved IP: %+v", resIP) @@ -206,7 +209,10 @@ func TestReservedIPAddresses_GetIPAddressVariants(t *testing.T) { }) if resErr != nil { - t.Fatalf("Failed to reserve IP. This test expects the user to have 0 prior reservations and the ip_reservation_limit to be 2. Error from the API: %v", resErr) + t.Fatalf( + "Failed to reserve IP. This test expects the user to have 0 prior reservations and the ip_reservation_limit to be 2. Error from the API: %v", + resErr, + ) } if resIP == nil { diff --git a/test/integration/nodebalancer_config_nodes_test.go b/test/integration/nodebalancer_config_nodes_test.go index 88ff33804..9948a285f 100644 --- a/test/integration/nodebalancer_config_nodes_test.go +++ b/test/integration/nodebalancer_config_nodes_test.go @@ -345,7 +345,10 @@ func TestNodeBalancerNode_Get_InVPC(t *testing.T) { } } -func setupNodeBalancerNode(t *testing.T, fixturesYaml string) (*linodego.Client, *linodego.NodeBalancer, *linodego.NodeBalancerConfig, *linodego.NodeBalancerNode, func(), error) { +func setupNodeBalancerNode( + t *testing.T, + fixturesYaml string, +) (*linodego.Client, *linodego.NodeBalancer, *linodego.NodeBalancerConfig, *linodego.NodeBalancerNode, func(), error) { t.Helper() var fixtureTeardown func() client, nodebalancer, config, fixtureTeardown, err := setupNodeBalancerConfig(t, fixturesYaml) diff --git a/test/integration/nodebalancer_configs_test.go b/test/integration/nodebalancer_configs_test.go index d262e6f46..6fc19203e 100644 --- a/test/integration/nodebalancer_configs_test.go +++ b/test/integration/nodebalancer_configs_test.go @@ -5,9 +5,8 @@ import ( "fmt" "testing" - "github.com/stretchr/testify/require" - "github.com/linode/linodego" + "github.com/stretchr/testify/require" ) var TestNodeBalancerConfigCreateOpts = linodego.NodeBalancerConfigCreateOptions{ @@ -131,7 +130,10 @@ func TestNodeBalancerConfig_UDP(t *testing.T) { } func TestNodeBalancerConfig_Rebuild_InVPCWithInstance(t *testing.T) { - client, nodebalancer, subnet, instanceVPCIP, teardown, err := setupNodeBalancerWithVPCAndInstance(t, "fixtures/TestNodeBalancerConfig_Rebuild_InVPCWithInstance") + client, nodebalancer, subnet, instanceVPCIP, teardown, err := setupNodeBalancerWithVPCAndInstance( + t, + "fixtures/TestNodeBalancerConfig_Rebuild_InVPCWithInstance", + ) defer teardown() if err != nil { t.Error(err) @@ -220,7 +222,11 @@ func createNodeBalancerConfig( return config, teardown, err } -func setupNodeBalancerConfig(t *testing.T, fixturesYaml string, modifiers ...func(options *linodego.NodeBalancerConfigCreateOptions)) (*linodego.Client, *linodego.NodeBalancer, *linodego.NodeBalancerConfig, func(), error) { +func setupNodeBalancerConfig( + t *testing.T, + fixturesYaml string, + modifiers ...func(options *linodego.NodeBalancerConfigCreateOptions), +) (*linodego.Client, *linodego.NodeBalancer, *linodego.NodeBalancerConfig, func(), error) { t.Helper() var fixtureTeardown func() client, nodebalancer, fixtureTeardown, err := setupNodeBalancer(t, fixturesYaml, nil) @@ -240,12 +246,19 @@ func setupNodeBalancerConfig(t *testing.T, fixturesYaml string, modifiers ...fun return client, nodebalancer, config, teardown, err } -func setupNodeBalancerWithVPCAndInstance(t *testing.T, fixturesYaml string) (*linodego.Client, *linodego.NodeBalancer, *linodego.VPCSubnet, string, func(), error) { +func setupNodeBalancerWithVPCAndInstance( + t *testing.T, + fixturesYaml string, +) (*linodego.Client, *linodego.NodeBalancer, *linodego.VPCSubnet, string, func(), error) { t.Helper() var fixtureTeardown func() - client, nodebalancer, _, subnet, fixtureTeardown, err := setupNodeBalancerWithVPC(t, fixturesYaml, func(client *linodego.Client, options *linodego.VPCCreateOptions) { - options.Region = getRegionsWithCaps(t, client, []string{"Linodes", "VPCs"})[1] - }) + client, nodebalancer, _, subnet, fixtureTeardown, err := setupNodeBalancerWithVPC( + t, + fixturesYaml, + func(client *linodego.Client, options *linodego.VPCCreateOptions) { + options.Region = getRegionsWithCaps(t, client, []string{"Linodes", "VPCs"})[1] + }, + ) if err != nil { t.Fatalf("Error creating nodebalancer, got error %v", err) } diff --git a/test/integration/nodebalancers_test.go b/test/integration/nodebalancers_test.go index bccb9e88b..003c86370 100644 --- a/test/integration/nodebalancers_test.go +++ b/test/integration/nodebalancers_test.go @@ -5,9 +5,8 @@ import ( "strings" "testing" - "github.com/stretchr/testify/require" - "github.com/linode/linodego" + "github.com/stretchr/testify/require" ) var ( @@ -33,9 +32,13 @@ func TestNodeBalancer_Create_create_smoke(t *testing.T) { } func TestNodeBalancer_Create_Type(t *testing.T) { - _, nodebalancer, teardown, err := setupNodeBalancer(t, "fixtures/TestNodeBalancer_Create_Type", []nbModifier{func(createOpts *linodego.NodeBalancerCreateOptions) { - createOpts.Type = linodego.NBTypeCommon - }}) + _, nodebalancer, teardown, err := setupNodeBalancer( + t, + "fixtures/TestNodeBalancer_Create_Type", + []nbModifier{func(createOpts *linodego.NodeBalancerCreateOptions) { + createOpts.Type = linodego.NBTypeCommon + }}, + ) defer teardown() if err != nil { @@ -170,7 +173,11 @@ func setupNodeBalancer(t *testing.T, fixturesYaml string, nbModifiers []nbModifi return client, nodebalancer, teardown, err } -func setupNodeBalancerWithVPC(t *testing.T, fixturesYaml string, vpcModifier ...vpcModifier) (*linodego.Client, *linodego.NodeBalancer, *linodego.VPC, *linodego.VPCSubnet, func(), error) { +func setupNodeBalancerWithVPC( + t *testing.T, + fixturesYaml string, + vpcModifier ...vpcModifier, +) (*linodego.Client, *linodego.NodeBalancer, *linodego.VPC, *linodego.VPCSubnet, func(), error) { t.Helper() var fixtureTeardown func() client, fixtureTeardown := createTestClient(t, fixturesYaml) diff --git a/test/integration/object_storage_keys_test.go b/test/integration/object_storage_keys_test.go index 876311abd..069272683 100644 --- a/test/integration/object_storage_keys_test.go +++ b/test/integration/object_storage_keys_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/linode/linodego" . "github.com/linode/linodego" ) @@ -136,7 +135,11 @@ func TestObjectStorageKeys_Limited(t *testing.T) { t.Error(err) } if !objectStorageKey.Limited || !cmp.Equal(objectStorageKey.BucketAccess, createOpts.BucketAccess) { - t.Errorf("objectStorageKey returned (%v) does not match objectStorageKey creation request (%v)", *objectStorageKey.BucketAccess, *createOpts.BucketAccess) + t.Errorf( + "objectStorageKey returned (%v) does not match objectStorageKey creation request (%v)", + *objectStorageKey.BucketAccess, + *createOpts.BucketAccess, + ) } } @@ -233,7 +236,13 @@ func TestObjectStorageKeys_Regional_Limited(t *testing.T) { } } -func setupObjectStorageKey(t *testing.T, createOpts ObjectStorageKeyCreateOptions, fixturesYaml string, client *Client, teardown func()) (*Client, *ObjectStorageKey, func(), error) { +func setupObjectStorageKey( + t *testing.T, + createOpts ObjectStorageKeyCreateOptions, + fixturesYaml string, + client *Client, + teardown func(), +) (*Client, *ObjectStorageKey, func(), error) { t.Helper() if (client == nil) != (teardown == nil) { diff --git a/test/integration/object_storage_quota_test.go b/test/integration/object_storage_quota_test.go index 109a198cc..03f7a6002 100644 --- a/test/integration/object_storage_quota_test.go +++ b/test/integration/object_storage_quota_test.go @@ -4,9 +4,8 @@ import ( "context" "testing" - "github.com/stretchr/testify/assert" - "github.com/linode/linodego" + "github.com/stretchr/testify/assert" ) func TestObjectStorageQuotas_Get(t *testing.T) { diff --git a/test/integration/placement_group_test.go b/test/integration/placement_group_test.go index d55559761..a6f4c7e42 100644 --- a/test/integration/placement_group_test.go +++ b/test/integration/placement_group_test.go @@ -6,9 +6,8 @@ import ( "reflect" "testing" - "github.com/stretchr/testify/require" - "github.com/linode/linodego" + "github.com/stretchr/testify/require" ) type placementGroupModifier func(*linodego.Client, *linodego.PlacementGroupCreateOptions) diff --git a/test/integration/postgres_db_config_test.go b/test/integration/postgres_db_config_test.go index c1be0867d..8643c9971 100644 --- a/test/integration/postgres_db_config_test.go +++ b/test/integration/postgres_db_config_test.go @@ -231,7 +231,11 @@ func TestDatabasePostgres_EngineConfig_Get(t *testing.T) { assert.IsType(t, false, config.PG.PGStatMonitorPGSMMaxBuckets.RequiresRestart) assert.IsType(t, "integer", config.PG.PGStatMonitorPGSMMaxBuckets.Type) - assert.IsType(t, "Controls which statements are counted. Specify top to track top-level statements (those issued directly by clients), all to also track nested statements (such as statements invoked within functions), or none to disable statement statistics collection. The default value is top.", config.PG.PGStatStatementsTrack.Description) + assert.IsType( + t, + "Controls which statements are counted. Specify top to track top-level statements (those issued directly by clients), all to also track nested statements (such as statements invoked within functions), or none to disable statement statistics collection. The default value is top.", + config.PG.PGStatStatementsTrack.Description, + ) assert.IsType(t, []string{"all", "top", "none"}, config.PG.PGStatStatementsTrack.Enum) assert.IsType(t, false, config.PG.PGStatStatementsTrack.RequiresRestart) assert.IsType(t, "string", config.PG.PGStatStatementsTrack.Type) @@ -250,7 +254,11 @@ func TestDatabasePostgres_EngineConfig_Get(t *testing.T) { assert.IsType(t, false, config.PG.Timezone.RequiresRestart) assert.IsType(t, "string", config.PG.Timezone.Type) - assert.IsType(t, "Specifies the number of bytes reserved to track the currently executing command for each active session.", config.PG.TrackActivityQuerySize.Description) + assert.IsType( + t, + "Specifies the number of bytes reserved to track the currently executing command for each active session.", + config.PG.TrackActivityQuerySize.Description, + ) assert.IsType(t, int(1024), config.PG.TrackActivityQuerySize.Example) assert.IsType(t, int(10240), config.PG.TrackActivityQuerySize.Maximum) assert.IsType(t, int(1024), config.PG.TrackActivityQuerySize.Minimum) diff --git a/test/integration/profile_security_question_test.go b/test/integration/profile_security_question_test.go index 30520eca3..ba61e07ec 100644 --- a/test/integration/profile_security_question_test.go +++ b/test/integration/profile_security_question_test.go @@ -18,5 +18,10 @@ func TestSecurityQuestions_List(t *testing.T) { require.NotEmpty(t, questions.SecurityQuestions, "Expected to see security questions returned") - require.Equal(t, "What was the name of your first pet?", questions.SecurityQuestions[0].Question, "Expected question 'What was the name of your first pet?'") + require.Equal( + t, + "What was the name of your first pet?", + questions.SecurityQuestions[0].Question, + "Expected question 'What was the name of your first pet?'", + ) } diff --git a/test/unit/account_promo_credits_test.go b/test/unit/account_promo_credits_test.go index 04b77e492..bed7a8cf7 100644 --- a/test/unit/account_promo_credits_test.go +++ b/test/unit/account_promo_credits_test.go @@ -29,7 +29,11 @@ func TestAccountPromoCredits_Add(t *testing.T) { assert.Equal(t, "10.00", promoCode.CreditMonthlyCap) assert.Equal(t, "50.00", promoCode.CreditRemaining) - assert.Equal(t, "Receive up to $10 off your services every month for 6 months! Unused credits will expire once this promotion period ends.", promoCode.Description) + assert.Equal( + t, + "Receive up to $10 off your services every month for 6 months! Unused credits will expire once this promotion period ends.", + promoCode.Description, + ) assert.Equal(t, "https://linode.com/10_a_month_promotion.svg", promoCode.ImageURL) assert.Equal(t, "all", promoCode.ServiceType) assert.Equal(t, "$10 off your Linode a month!", promoCode.Summary) diff --git a/test/unit/account_test.go b/test/unit/account_test.go index c6c7d0c35..d3521b855 100644 --- a/test/unit/account_test.go +++ b/test/unit/account_test.go @@ -39,13 +39,21 @@ func TestAccount_Get(t *testing.T) { } assert.Equal(t, "E1AF5EEC-526F-487D-B317EBEB34C87D71", accountInfo.EUUID) assert.Equal(t, "akamai", accountInfo.BillingSource) - assert.Equal(t, []string{"Linodes", "NodeBalancers", "Block Storage", "Object Storage", "Placement Groups", "Block Storage Encryption"}, accountInfo.Capabilities) + assert.Equal( + t, + []string{"Linodes", "NodeBalancers", "Block Storage", "Object Storage", "Placement Groups", "Block Storage Encryption"}, + accountInfo.Capabilities, + ) assert.Equal(t, "Philadelphia", accountInfo.City) assert.Equal(t, "PA", accountInfo.State) assert.Equal(t, "10.00", accountInfo.ActivePromotions[0].CreditMonthlyCap) assert.Equal(t, "50.00", accountInfo.ActivePromotions[0].CreditRemaining) - assert.Equal(t, "Receive up to $10 off your services every month for 6 months! Unused credits will expire once this promotion period ends.", accountInfo.ActivePromotions[0].Description) + assert.Equal( + t, + "Receive up to $10 off your services every month for 6 months! Unused credits will expire once this promotion period ends.", + accountInfo.ActivePromotions[0].Description, + ) assert.Equal(t, "https://linode.com/10_a_month_promotion.svg", accountInfo.ActivePromotions[0].ImageURL) assert.Equal(t, "all", accountInfo.ActivePromotions[0].ServiceType) assert.Equal(t, "$10 off your Linode a month!", accountInfo.ActivePromotions[0].Summary) @@ -88,7 +96,11 @@ func TestAccount_Update(t *testing.T) { } assert.Equal(t, "E1AF5EEC-526F-487D-B317EBEB34C87D71", accountInfo.EUUID) assert.Equal(t, "akamai", accountInfo.BillingSource) - assert.Equal(t, []string{"Linodes", "NodeBalancers", "Block Storage", "Object Storage", "Placement Groups", "Block Storage Encryption"}, accountInfo.Capabilities) + assert.Equal( + t, + []string{"Linodes", "NodeBalancers", "Block Storage", "Object Storage", "Placement Groups", "Block Storage Encryption"}, + accountInfo.Capabilities, + ) assert.Equal(t, "Cambridge", accountInfo.City) assert.Equal(t, "MA", accountInfo.State) diff --git a/test/unit/client_test.go b/test/unit/client_test.go index e4c3be91d..bf8ffd14e 100644 --- a/test/unit/client_test.go +++ b/test/unit/client_test.go @@ -5,10 +5,9 @@ import ( "net/http" "testing" - "golang.org/x/net/http2" - "github.com/jarcoal/httpmock" "github.com/linode/linodego" + "golang.org/x/net/http2" ) func TestClient_NGINXRetry(t *testing.T) { diff --git a/test/unit/domain_test.go b/test/unit/domain_test.go index f39f9dac8..28fa89f3f 100644 --- a/test/unit/domain_test.go +++ b/test/unit/domain_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/jarcoal/httpmock" - "github.com/linode/linodego" "github.com/stretchr/testify/assert" ) diff --git a/test/unit/images_test.go b/test/unit/images_test.go index 0eac4b45a..a79baa948 100644 --- a/test/unit/images_test.go +++ b/test/unit/images_test.go @@ -8,10 +8,8 @@ import ( "time" "github.com/jarcoal/httpmock" - - "github.com/stretchr/testify/assert" - "github.com/linode/linodego" + "github.com/stretchr/testify/assert" ) func TestImage_List(t *testing.T) { diff --git a/test/unit/instance_test.go b/test/unit/instance_test.go index acadd5180..ff512eeed 100644 --- a/test/unit/instance_test.go +++ b/test/unit/instance_test.go @@ -8,7 +8,6 @@ import ( "github.com/jarcoal/httpmock" "github.com/linode/linodego" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/test/unit/lke_node_pools_test.go b/test/unit/lke_node_pools_test.go index 48db8c31d..7b4fcb129 100644 --- a/test/unit/lke_node_pools_test.go +++ b/test/unit/lke_node_pools_test.go @@ -4,10 +4,9 @@ import ( "context" "testing" + "github.com/jarcoal/httpmock" "github.com/linode/linodego" "github.com/stretchr/testify/assert" - - "github.com/jarcoal/httpmock" ) func Ptr[T any](v T) *T { diff --git a/test/unit/mysql_test.go b/test/unit/mysql_test.go index 996d84ac9..94b99a2f2 100644 --- a/test/unit/mysql_test.go +++ b/test/unit/mysql_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/jarcoal/httpmock" - "github.com/linode/linodego" "github.com/stretchr/testify/assert" ) @@ -364,8 +363,11 @@ func TestDatabaseMySQLConfig_Get(t *testing.T) { assert.False(t, config.MySQL.InnoDBChangeBufferMaxSize.RequiresRestart) assert.Equal(t, "integer", config.MySQL.InnoDBChangeBufferMaxSize.Type) - assert.Equal(t, "Specifies whether flushing a page from the InnoDB buffer pool also flushes other dirty pages in the same extent (default is 1): 0 - dirty pages in the same extent are not flushed, 1 - flush contiguous dirty pages in the same extent, 2 - flush dirty pages in the same extent", - config.MySQL.InnoDBFlushNeighbors.Description) + assert.Equal( + t, + "Specifies whether flushing a page from the InnoDB buffer pool also flushes other dirty pages in the same extent (default is 1): 0 - dirty pages in the same extent are not flushed, 1 - flush contiguous dirty pages in the same extent, 2 - flush dirty pages in the same extent", + config.MySQL.InnoDBFlushNeighbors.Description, + ) assert.Equal(t, 0, config.MySQL.InnoDBFlushNeighbors.Example) assert.Equal(t, 2, config.MySQL.InnoDBFlushNeighbors.Maximum) assert.Equal(t, 0, config.MySQL.InnoDBFlushNeighbors.Minimum) @@ -412,16 +414,22 @@ func TestDatabaseMySQLConfig_Get(t *testing.T) { assert.False(t, config.MySQL.InnoDBOnlineAlterLogMaxSize.RequiresRestart) assert.Equal(t, "integer", config.MySQL.InnoDBOnlineAlterLogMaxSize.Type) - assert.Equal(t, "The number of I/O threads for read operations in InnoDB. Default is 4. Changing this parameter will lead to a restart of the MySQL service.", - config.MySQL.InnoDBReadIOThreads.Description) + assert.Equal( + t, + "The number of I/O threads for read operations in InnoDB. Default is 4. Changing this parameter will lead to a restart of the MySQL service.", + config.MySQL.InnoDBReadIOThreads.Description, + ) assert.Equal(t, 10, config.MySQL.InnoDBReadIOThreads.Example) assert.Equal(t, 64, config.MySQL.InnoDBReadIOThreads.Maximum) assert.Equal(t, 1, config.MySQL.InnoDBReadIOThreads.Minimum) assert.True(t, config.MySQL.InnoDBReadIOThreads.RequiresRestart) assert.Equal(t, "integer", config.MySQL.InnoDBReadIOThreads.Type) - assert.Equal(t, "When enabled a transaction timeout causes InnoDB to abort and roll back the entire transaction. Changing this parameter will lead to a restart of the MySQL service.", - config.MySQL.InnoDBRollbackOnTimeout.Description) + assert.Equal( + t, + "When enabled a transaction timeout causes InnoDB to abort and roll back the entire transaction. Changing this parameter will lead to a restart of the MySQL service.", + config.MySQL.InnoDBRollbackOnTimeout.Description, + ) assert.Equal(t, true, config.MySQL.InnoDBRollbackOnTimeout.Example) assert.True(t, config.MySQL.InnoDBRollbackOnTimeout.RequiresRestart) assert.Equal(t, "boolean", config.MySQL.InnoDBRollbackOnTimeout.Type) @@ -434,8 +442,11 @@ func TestDatabaseMySQLConfig_Get(t *testing.T) { assert.False(t, config.MySQL.InnoDBThreadConcurrency.RequiresRestart) assert.Equal(t, "integer", config.MySQL.InnoDBThreadConcurrency.Type) - assert.Equal(t, "The number of I/O threads for write operations in InnoDB. Default is 4. Changing this parameter will lead to a restart of the MySQL service.", - config.MySQL.InnoDBWriteIOThreads.Description) + assert.Equal( + t, + "The number of I/O threads for write operations in InnoDB. Default is 4. Changing this parameter will lead to a restart of the MySQL service.", + config.MySQL.InnoDBWriteIOThreads.Description, + ) assert.Equal(t, 10, config.MySQL.InnoDBWriteIOThreads.Example) assert.Equal(t, 64, config.MySQL.InnoDBWriteIOThreads.Maximum) assert.Equal(t, 1, config.MySQL.InnoDBWriteIOThreads.Minimum) @@ -473,8 +484,11 @@ func TestDatabaseMySQLConfig_Get(t *testing.T) { assert.False(t, config.MySQL.MaxHeapTableSize.RequiresRestart) assert.Equal(t, "integer", config.MySQL.MaxHeapTableSize.Type) - assert.Equal(t, "Start sizes of connection buffer and result buffer. Default is 16384 (16K). Changing this parameter will lead to a restart of the MySQL service.", - config.MySQL.NetBufferLength.Description) + assert.Equal( + t, + "Start sizes of connection buffer and result buffer. Default is 16384 (16K). Changing this parameter will lead to a restart of the MySQL service.", + config.MySQL.NetBufferLength.Description, + ) assert.Equal(t, 16384, config.MySQL.NetBufferLength.Example) assert.Equal(t, 1048576, config.MySQL.NetBufferLength.Maximum) assert.Equal(t, 1024, config.MySQL.NetBufferLength.Minimum) @@ -505,16 +519,22 @@ func TestDatabaseMySQLConfig_Get(t *testing.T) { assert.False(t, config.MySQL.SortBufferSize.RequiresRestart) assert.Equal(t, "integer", config.MySQL.SortBufferSize.Type) - assert.Equal(t, "Global SQL mode. Set to empty to use MySQL server defaults. When creating a new service and not setting this field Akamai default SQL mode (strict, SQL standard compliant) will be assigned.", - config.MySQL.SQLMode.Description) + assert.Equal( + t, + "Global SQL mode. Set to empty to use MySQL server defaults. When creating a new service and not setting this field Akamai default SQL mode (strict, SQL standard compliant) will be assigned.", + config.MySQL.SQLMode.Description, + ) assert.Equal(t, "ANSI,TRADITIONAL", config.MySQL.SQLMode.Example) assert.Equal(t, 1024, config.MySQL.SQLMode.MaxLength) assert.Equal(t, "^[A-Z_]*(,[A-Z_]+)*$", config.MySQL.SQLMode.Pattern) assert.False(t, config.MySQL.SQLMode.RequiresRestart) assert.Equal(t, "string", config.MySQL.SQLMode.Type) - assert.Equal(t, "Require primary key to be defined for new tables or old tables modified with ALTER TABLE and fail if missing. It is recommended to always have primary keys because various functionality may break if any large table is missing them.", - config.MySQL.SQLRequirePrimaryKey.Description) + assert.Equal( + t, + "Require primary key to be defined for new tables or old tables modified with ALTER TABLE and fail if missing. It is recommended to always have primary keys because various functionality may break if any large table is missing them.", + config.MySQL.SQLRequirePrimaryKey.Description, + ) assert.Equal(t, true, config.MySQL.SQLRequirePrimaryKey.Example) assert.False(t, config.MySQL.SQLRequirePrimaryKey.RequiresRestart) assert.Equal(t, "boolean", config.MySQL.SQLRequirePrimaryKey.Type) @@ -535,8 +555,11 @@ func TestDatabaseMySQLConfig_Get(t *testing.T) { assert.False(t, config.MySQL.WaitTimeout.RequiresRestart) assert.Equal(t, "integer", config.MySQL.WaitTimeout.Type) - assert.Equal(t, "The minimum amount of time in seconds to keep binlog entries before deletion. This may be extended for services that require binlog entries for longer than the default for example if using the MySQL Debezium Kafka connector.", - config.BinlogRetentionPeriod.Description) + assert.Equal( + t, + "The minimum amount of time in seconds to keep binlog entries before deletion. This may be extended for services that require binlog entries for longer than the default for example if using the MySQL Debezium Kafka connector.", + config.BinlogRetentionPeriod.Description, + ) assert.Equal(t, 600, config.BinlogRetentionPeriod.Example) assert.Equal(t, 86400, config.BinlogRetentionPeriod.Maximum) assert.Equal(t, 600, config.BinlogRetentionPeriod.Minimum) diff --git a/test/unit/nodebalancer_configs_test.go b/test/unit/nodebalancer_configs_test.go index c247d1a73..cfddeab05 100644 --- a/test/unit/nodebalancer_configs_test.go +++ b/test/unit/nodebalancer_configs_test.go @@ -4,10 +4,9 @@ import ( "context" "testing" - "github.com/stretchr/testify/require" - "github.com/linode/linodego" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestNodeBalancerConfigs_UDP(t *testing.T) { diff --git a/test/unit/nodebalancers_test.go b/test/unit/nodebalancers_test.go index 50072adce..b4e7cd273 100644 --- a/test/unit/nodebalancers_test.go +++ b/test/unit/nodebalancers_test.go @@ -5,10 +5,9 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - "github.com/linode/linodego" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestNodeBalancers_UDP(t *testing.T) { diff --git a/test/unit/object_storage_test.go b/test/unit/object_storage_test.go index 61ee86161..be025e4bd 100644 --- a/test/unit/object_storage_test.go +++ b/test/unit/object_storage_test.go @@ -4,9 +4,8 @@ import ( "context" "testing" - "github.com/stretchr/testify/assert" - "github.com/jarcoal/httpmock" + "github.com/stretchr/testify/assert" ) func TestObjectStorage_Cancel(t *testing.T) { diff --git a/test/unit/postgres_test.go b/test/unit/postgres_test.go index a3356e7e1..8ab37ff45 100644 --- a/test/unit/postgres_test.go +++ b/test/unit/postgres_test.go @@ -387,43 +387,61 @@ func TestDatabasePostgreSQLConfig_Get(t *testing.T) { assert.False(t, config.PG.AutovacuumAnalyzeScaleFactor.RequiresRestart) assert.Equal(t, "number", config.PG.AutovacuumAnalyzeScaleFactor.Type) - assert.Equal(t, "Specifies the minimum number of inserted, updated or deleted tuples needed to trigger an ANALYZE in any one table. The default is 50 tuples.", - config.PG.AutovacuumAnalyzeThreshold.Description) + assert.Equal( + t, + "Specifies the minimum number of inserted, updated or deleted tuples needed to trigger an ANALYZE in any one table. The default is 50 tuples.", + config.PG.AutovacuumAnalyzeThreshold.Description, + ) assert.Equal(t, int32(2147483647), config.PG.AutovacuumAnalyzeThreshold.Maximum) assert.Equal(t, int32(0), config.PG.AutovacuumAnalyzeThreshold.Minimum) assert.False(t, config.PG.AutovacuumAnalyzeThreshold.RequiresRestart) assert.Equal(t, "integer", config.PG.AutovacuumAnalyzeThreshold.Type) - assert.Equal(t, "Specifies the maximum number of autovacuum processes (other than the autovacuum launcher) that may be running at any one time. The default is three. This parameter can only be set at server start.", - config.PG.AutovacuumMaxWorkers.Description) + assert.Equal( + t, + "Specifies the maximum number of autovacuum processes (other than the autovacuum launcher) that may be running at any one time. The default is three. This parameter can only be set at server start.", + config.PG.AutovacuumMaxWorkers.Description, + ) assert.Equal(t, 20, config.PG.AutovacuumMaxWorkers.Maximum) assert.Equal(t, 1, config.PG.AutovacuumMaxWorkers.Minimum) assert.False(t, config.PG.AutovacuumMaxWorkers.RequiresRestart) assert.Equal(t, "integer", config.PG.AutovacuumMaxWorkers.Type) - assert.Equal(t, "Specifies the minimum delay between autovacuum runs on any given database. The delay is measured in seconds, and the default is one minute", - config.PG.AutovacuumNaptime.Description) + assert.Equal( + t, + "Specifies the minimum delay between autovacuum runs on any given database. The delay is measured in seconds, and the default is one minute", + config.PG.AutovacuumNaptime.Description, + ) assert.Equal(t, 86400, config.PG.AutovacuumNaptime.Maximum) assert.Equal(t, 1, config.PG.AutovacuumNaptime.Minimum) assert.False(t, config.PG.AutovacuumNaptime.RequiresRestart) assert.Equal(t, "integer", config.PG.AutovacuumNaptime.Type) - assert.Equal(t, "Specifies the cost delay value that will be used in automatic VACUUM operations. If -1 is specified, the regular vacuum_cost_delay value will be used. The default value is 20 milliseconds", - config.PG.AutovacuumVacuumCostDelay.Description) + assert.Equal( + t, + "Specifies the cost delay value that will be used in automatic VACUUM operations. If -1 is specified, the regular vacuum_cost_delay value will be used. The default value is 20 milliseconds", + config.PG.AutovacuumVacuumCostDelay.Description, + ) assert.Equal(t, 100, config.PG.AutovacuumVacuumCostDelay.Maximum) assert.Equal(t, -1, config.PG.AutovacuumVacuumCostDelay.Minimum) assert.False(t, config.PG.AutovacuumVacuumCostDelay.RequiresRestart) assert.Equal(t, "integer", config.PG.AutovacuumVacuumCostDelay.Type) - assert.Equal(t, "Specifies the cost limit value that will be used in automatic VACUUM operations. If -1 is specified (which is the default), the regular vacuum_cost_limit value will be used.", - config.PG.AutovacuumVacuumCostLimit.Description) + assert.Equal( + t, + "Specifies the cost limit value that will be used in automatic VACUUM operations. If -1 is specified (which is the default), the regular vacuum_cost_limit value will be used.", + config.PG.AutovacuumVacuumCostLimit.Description, + ) assert.Equal(t, 10000, config.PG.AutovacuumVacuumCostLimit.Maximum) assert.Equal(t, -1, config.PG.AutovacuumVacuumCostLimit.Minimum) assert.False(t, config.PG.AutovacuumVacuumCostLimit.RequiresRestart) assert.Equal(t, "integer", config.PG.AutovacuumVacuumCostLimit.Type) - assert.Equal(t, "Specifies a fraction of the table size to add to autovacuum_vacuum_threshold when deciding whether to trigger a VACUUM. The default is 0.2 (20% of table size)", - config.PG.AutovacuumVacuumScaleFactor.Description) + assert.Equal( + t, + "Specifies a fraction of the table size to add to autovacuum_vacuum_threshold when deciding whether to trigger a VACUUM. The default is 0.2 (20% of table size)", + config.PG.AutovacuumVacuumScaleFactor.Description, + ) assert.Equal(t, 1.0, config.PG.AutovacuumVacuumScaleFactor.Maximum) assert.Equal(t, 0.0, config.PG.AutovacuumVacuumScaleFactor.Minimum) assert.False(t, config.PG.AutovacuumVacuumScaleFactor.RequiresRestart) @@ -444,24 +462,33 @@ func TestDatabasePostgreSQLConfig_Get(t *testing.T) { assert.False(t, config.PG.BGWriterDelay.RequiresRestart) assert.Equal(t, "integer", config.PG.BGWriterDelay.Type) - assert.Equal(t, "Whenever more than bgwriter_flush_after bytes have been written by the background writer, attempt to force the OS to issue these writes to the underlying storage. Specified in kilobytes, default is 512. Setting of 0 disables forced writeback.", - config.PG.BGWriterFlushAfter.Description) + assert.Equal( + t, + "Whenever more than bgwriter_flush_after bytes have been written by the background writer, attempt to force the OS to issue these writes to the underlying storage. Specified in kilobytes, default is 512. Setting of 0 disables forced writeback.", + config.PG.BGWriterFlushAfter.Description, + ) assert.Equal(t, 512, config.PG.BGWriterFlushAfter.Example) assert.Equal(t, 2048, config.PG.BGWriterFlushAfter.Maximum) assert.Equal(t, 0, config.PG.BGWriterFlushAfter.Minimum) assert.False(t, config.PG.BGWriterFlushAfter.RequiresRestart) assert.Equal(t, "integer", config.PG.BGWriterFlushAfter.Type) - assert.Equal(t, "In each round, no more than this many buffers will be written by the background writer. Setting this to zero disables background writing. Default is 100.", - config.PG.BGWriterLRUMaxPages.Description) + assert.Equal( + t, + "In each round, no more than this many buffers will be written by the background writer. Setting this to zero disables background writing. Default is 100.", + config.PG.BGWriterLRUMaxPages.Description, + ) assert.Equal(t, 100, config.PG.BGWriterLRUMaxPages.Example) assert.Equal(t, 1073741823, config.PG.BGWriterLRUMaxPages.Maximum) assert.Equal(t, 0, config.PG.BGWriterLRUMaxPages.Minimum) assert.False(t, config.PG.BGWriterLRUMaxPages.RequiresRestart) assert.Equal(t, "integer", config.PG.BGWriterLRUMaxPages.Type) - assert.Equal(t, "The average recent need for new buffers is multiplied by bgwriter_lru_multiplier to arrive at an estimate of the number that will be needed during the next round, (up to bgwriter_lru_maxpages). 1.0 represents a “just in time” policy of writing exactly the number of buffers predicted to be needed. Larger values provide some cushion against spikes in demand, while smaller values intentionally leave writes to be done by server processes. The default is 2.0.", - config.PG.BGWriterLRUMultiplier.Description) + assert.Equal( + t, + "The average recent need for new buffers is multiplied by bgwriter_lru_multiplier to arrive at an estimate of the number that will be needed during the next round, (up to bgwriter_lru_maxpages). 1.0 represents a “just in time” policy of writing exactly the number of buffers predicted to be needed. Larger values provide some cushion against spikes in demand, while smaller values intentionally leave writes to be done by server processes. The default is 2.0.", + config.PG.BGWriterLRUMultiplier.Description, + ) assert.Equal(t, 2.0, config.PG.BGWriterLRUMultiplier.Example) assert.Equal(t, 10.0, config.PG.BGWriterLRUMultiplier.Maximum) assert.Equal(t, 0.0, config.PG.BGWriterLRUMultiplier.Minimum) @@ -545,8 +572,11 @@ func TestDatabasePostgreSQLConfig_Get(t *testing.T) { assert.False(t, config.PG.MaxReplicationSlots.RequiresRestart) assert.Equal(t, "integer", config.PG.MaxReplicationSlots.Type) - assert.Equal(t, "PostgreSQL maximum WAL size (MB) reserved for replication slots. Default is -1 (unlimited). wal_keep_size minimum WAL size setting takes precedence over this.", - config.PG.MaxSlotWALKeepSize.Description) + assert.Equal( + t, + "PostgreSQL maximum WAL size (MB) reserved for replication slots. Default is -1 (unlimited). wal_keep_size minimum WAL size setting takes precedence over this.", + config.PG.MaxSlotWALKeepSize.Description, + ) assert.Equal(t, int32(2147483647), config.PG.MaxSlotWALKeepSize.Maximum) assert.Equal(t, int32(-1), config.PG.MaxSlotWALKeepSize.Minimum) assert.False(t, config.PG.MaxSlotWALKeepSize.RequiresRestart) @@ -624,8 +654,11 @@ func TestDatabasePostgreSQLConfig_Get(t *testing.T) { assert.False(t, config.PG.PGStatMonitorPGSMMaxBuckets.RequiresRestart) assert.Equal(t, "integer", config.PG.PGStatMonitorPGSMMaxBuckets.Type) - assert.Equal(t, "Controls which statements are counted. Specify top to track top-level statements (those issued directly by clients), all to also track nested statements (such as statements invoked within functions), or none to disable statement statistics collection. The default value is top.", - config.PG.PGStatStatementsTrack.Description) + assert.Equal( + t, + "Controls which statements are counted. Specify top to track top-level statements (those issued directly by clients), all to also track nested statements (such as statements invoked within functions), or none to disable statement statistics collection. The default value is top.", + config.PG.PGStatStatementsTrack.Description, + ) assert.Equal(t, []string{"all", "top", "none"}, config.PG.PGStatStatementsTrack.Enum) assert.False(t, config.PG.PGStatStatementsTrack.RequiresRestart) assert.Equal(t, "string", config.PG.PGStatStatementsTrack.Type) @@ -667,15 +700,21 @@ func TestDatabasePostgreSQLConfig_Get(t *testing.T) { assert.False(t, config.PG.TrackFunctions.RequiresRestart) assert.Equal(t, "string", config.PG.TrackFunctions.Type) - assert.Equal(t, "Enables timing of database I/O calls. This parameter is off by default, because it will repeatedly query the operating system for the current time, which may cause significant overhead on some platforms.", - config.PG.TrackIOTiming.Description) + assert.Equal( + t, + "Enables timing of database I/O calls. This parameter is off by default, because it will repeatedly query the operating system for the current time, which may cause significant overhead on some platforms.", + config.PG.TrackIOTiming.Description, + ) assert.Equal(t, "off", config.PG.TrackIOTiming.Example) assert.Equal(t, []string{"off", "on"}, config.PG.TrackIOTiming.Enum) assert.False(t, config.PG.TrackIOTiming.RequiresRestart) assert.Equal(t, "string", config.PG.TrackIOTiming.Type) - assert.Equal(t, "Terminate replication connections that are inactive for longer than this amount of time, in milliseconds. Setting this value to zero disables the timeout.", - config.PG.WALSenderTimeout.Description) + assert.Equal( + t, + "Terminate replication connections that are inactive for longer than this amount of time, in milliseconds. Setting this value to zero disables the timeout.", + config.PG.WALSenderTimeout.Description, + ) assert.Equal(t, 60000, config.PG.WALSenderTimeout.Example) assert.False(t, config.PG.WALSenderTimeout.RequiresRestart) assert.Equal(t, "integer", config.PG.WALSenderTimeout.Type) @@ -688,8 +727,11 @@ func TestDatabasePostgreSQLConfig_Get(t *testing.T) { assert.False(t, config.PG.WALWriterDelay.RequiresRestart) assert.Equal(t, "integer", config.PG.WALWriterDelay.Type) - assert.Equal(t, "Enable the pg_stat_monitor extension. Enabling this extension will cause the cluster to be restarted.When this extension is enabled, pg_stat_statements results for utility commands are unreliable", - config.PGStatMonitorEnable.Description) + assert.Equal( + t, + "Enable the pg_stat_monitor extension. Enabling this extension will cause the cluster to be restarted.When this extension is enabled, pg_stat_statements results for utility commands are unreliable", + config.PGStatMonitorEnable.Description, + ) assert.True(t, config.PGStatMonitorEnable.RequiresRestart) assert.Equal(t, "boolean", config.PGStatMonitorEnable.Type) @@ -700,16 +742,22 @@ func TestDatabasePostgreSQLConfig_Get(t *testing.T) { assert.False(t, config.PGLookout.PGLookoutMaxFailoverReplicationTimeLag.RequiresRestart) assert.Equal(t, "integer", config.PGLookout.PGLookoutMaxFailoverReplicationTimeLag.Type) - assert.Equal(t, "Percentage of total RAM that the database server uses for shared memory buffers. Valid range is 20-60 (float), which corresponds to 20% - 60%. This setting adjusts the shared_buffers configuration value.", - config.SharedBuffersPercentage.Description) + assert.Equal( + t, + "Percentage of total RAM that the database server uses for shared memory buffers. Valid range is 20-60 (float), which corresponds to 20% - 60%. This setting adjusts the shared_buffers configuration value.", + config.SharedBuffersPercentage.Description, + ) assert.Equal(t, 41.5, config.SharedBuffersPercentage.Example) assert.Equal(t, 60.0, config.SharedBuffersPercentage.Maximum) assert.Equal(t, 20.0, config.SharedBuffersPercentage.Minimum) assert.False(t, config.SharedBuffersPercentage.RequiresRestart) assert.Equal(t, "number", config.SharedBuffersPercentage.Type) - assert.Equal(t, "Sets the maximum amount of memory to be used by a query operation (such as a sort or hash table) before writing to temporary disk files, in MB. Default is 1MB + 0.075% of total RAM (up to 32MB).", - config.WorkMem.Description) + assert.Equal( + t, + "Sets the maximum amount of memory to be used by a query operation (such as a sort or hash table) before writing to temporary disk files, in MB. Default is 1MB + 0.075% of total RAM (up to 32MB).", + config.WorkMem.Description, + ) assert.Equal(t, 4, config.WorkMem.Example) assert.Equal(t, 1024, config.WorkMem.Maximum) assert.Equal(t, 1, config.WorkMem.Minimum) diff --git a/test/unit/profile_devices_test.go b/test/unit/profile_devices_test.go index b58a480cd..a0affe084 100644 --- a/test/unit/profile_devices_test.go +++ b/test/unit/profile_devices_test.go @@ -23,7 +23,11 @@ func TestProfileDevices_Get(t *testing.T) { assert.Equal(t, 123, device.ID) assert.Equal(t, "203.0.113.1", device.LastRemoteAddr) - assert.Equal(t, "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36 Vivaldi/2.1.1337.36", device.UserAgent) + assert.Equal( + t, + "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36 Vivaldi/2.1.1337.36", + device.UserAgent, + ) } func TestProfileDevices_List(t *testing.T) { @@ -44,7 +48,11 @@ func TestProfileDevices_List(t *testing.T) { assert.Equal(t, 123, device.ID) assert.Equal(t, "203.0.113.1", device.LastRemoteAddr) - assert.Equal(t, "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36 Vivaldi/2.1.1337.36", device.UserAgent) + assert.Equal( + t, + "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36 Vivaldi/2.1.1337.36", + device.UserAgent, + ) } func TestProfileDevices_Delete(t *testing.T) { diff --git a/test/unit/profile_security_questions_test.go b/test/unit/profile_security_questions_test.go index 7735df24a..6231ecfa2 100644 --- a/test/unit/profile_security_questions_test.go +++ b/test/unit/profile_security_questions_test.go @@ -4,10 +4,9 @@ import ( "context" "testing" - "github.com/stretchr/testify/assert" - "github.com/jarcoal/httpmock" "github.com/linode/linodego" + "github.com/stretchr/testify/assert" ) func TestSecurityQuestions_List(t *testing.T) { diff --git a/test/unit/profile_tfa_test.go b/test/unit/profile_tfa_test.go index 965491093..d819011d2 100644 --- a/test/unit/profile_tfa_test.go +++ b/test/unit/profile_tfa_test.go @@ -5,10 +5,9 @@ import ( "testing" "time" - "github.com/stretchr/testify/assert" - "github.com/jarcoal/httpmock" "github.com/linode/linodego" + "github.com/stretchr/testify/assert" ) func TestTwoFactor_CreateSecret_smoke(t *testing.T) { diff --git a/test/unit/support_test.go b/test/unit/support_test.go index 62a4bec74..4f03233c5 100644 --- a/test/unit/support_test.go +++ b/test/unit/support_test.go @@ -28,7 +28,11 @@ func TestSupportTicket_List(t *testing.T) { assert.Equal(t, []string{"screenshot.jpg", "screenshot.txt"}, ticket.Attachments) assert.Equal(t, false, ticket.Closeable) - assert.Equal(t, "I am having trouble setting the root password on my Linode. I tried following the instructions but something is not working. Can you please help me figure out how I can reset it?", ticket.Description) + assert.Equal( + t, + "I am having trouble setting the root password on my Linode. I tried following the instructions but something is not working. Can you please help me figure out how I can reset it?", + ticket.Description, + ) assert.Equal(t, 10400, ticket.Entity.ID) assert.Equal(t, "linode123456", ticket.Entity.Label) assert.Equal(t, "linode", ticket.Entity.Type) @@ -58,7 +62,11 @@ func TestSupportTicket_Get(t *testing.T) { assert.Equal(t, []string{"screenshot.jpg", "screenshot.txt"}, ticket.Attachments) assert.Equal(t, false, ticket.Closeable) - assert.Equal(t, "I am having trouble setting the root password on my Linode. I tried following the instructions but something is not working. Can you please help me figure out how I can reset it?", ticket.Description) + assert.Equal( + t, + "I am having trouble setting the root password on my Linode. I tried following the instructions but something is not working. Can you please help me figure out how I can reset it?", + ticket.Description, + ) assert.Equal(t, 10400, ticket.Entity.ID) assert.Equal(t, "linode123456", ticket.Entity.Label) assert.Equal(t, "linode", ticket.Entity.Type) diff --git a/test/unit/util_test.go b/test/unit/util_test.go index 5614b51e0..ae6b655f4 100644 --- a/test/unit/util_test.go +++ b/test/unit/util_test.go @@ -6,10 +6,9 @@ import ( "regexp" "testing" + "github.com/jarcoal/httpmock" "github.com/linode/linodego" "github.com/linode/linodego/internal/testutil" - - "github.com/jarcoal/httpmock" ) func mockRequestBodyValidate(t *testing.T, expected interface{}, response interface{}) httpmock.Responder { diff --git a/waitfor.go b/waitfor.go index bbb20ee4a..db8e04ae4 100644 --- a/waitfor.go +++ b/waitfor.go @@ -122,7 +122,13 @@ func (client Client) WaitForVolumeStatus(ctx context.Context, volumeID int, stat // WaitForSnapshotStatus waits for the Snapshot to reach the desired state // before returning. It will timeout with an error after timeoutSeconds. -func (client Client) WaitForSnapshotStatus(ctx context.Context, instanceID int, snapshotID int, status InstanceSnapshotStatus, timeoutSeconds int) (*InstanceSnapshot, error) { +func (client Client) WaitForSnapshotStatus( + ctx context.Context, + instanceID int, + snapshotID int, + status InstanceSnapshotStatus, + timeoutSeconds int, +) (*InstanceSnapshot, error) { ctx, cancel := context.WithTimeout(ctx, time.Duration(timeoutSeconds)*time.Second) defer cancel()