From: Daniel Swarbrick <dswarbrick@debian.org>
Date: Tue, 17 Dec 2024 17:00:14 +0100
Subject: Disable 32-bit incompatible tests

Bug: https://github.com/linode/linodego/issues/644

These tests will fail to build on 32-bit archs due to untyped int
overflows.
---
 test/unit/instance_64bit_test.go |  28 ++++
 test/unit/instance_test.go       |   3 +-
 test/unit/mysql_64bit_test.go    | 268 +++++++++++++++++++++++++++++++++++++++
 test/unit/mysql_test.go          |   2 +
 4 files changed, 300 insertions(+), 1 deletion(-)
 create mode 100644 test/unit/instance_64bit_test.go
 create mode 100644 test/unit/mysql_64bit_test.go

diff --git a/test/unit/instance_64bit_test.go b/test/unit/instance_64bit_test.go
new file mode 100644
index 0000000..eff30ac
--- /dev/null
+++ b/test/unit/instance_64bit_test.go
@@ -0,0 +1,28 @@
+//go:build !(386 || arm)
+
+package unit
+
+import (
+	"context"
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestInstance_Get_MonthlyTransfer(t *testing.T) {
+	fixtureData, err := fixtures.GetFixture("instance_monthly_transfer_get")
+	assert.NoError(t, err)
+
+	var base ClientBaseCase
+	base.SetUp(t)
+	defer base.TearDown(t)
+
+	base.MockGet("linode/instances/12345/transfer/2024/11", fixtureData)
+
+	stats, err := base.Client.GetInstanceTransferMonthly(context.Background(), 12345, 2024, 11)
+	assert.NoError(t, err)
+
+	assert.Equal(t, 30471077120, stats.BytesIn)
+	assert.Equal(t, 22956600198, stats.BytesOut)
+	assert.Equal(t, 53427677318, stats.BytesTotal)
+}
diff --git a/test/unit/instance_test.go b/test/unit/instance_test.go
index f10e08d..f53539d 100644
--- a/test/unit/instance_test.go
+++ b/test/unit/instance_test.go
@@ -3,7 +3,6 @@ package unit
 import (
 	"context"
 	"fmt"
-	"strconv"
 	"testing"
 
 	"github.com/jarcoal/httpmock"
@@ -113,6 +112,7 @@ func TestInstance_ResetPassword(t *testing.T) {
 	}
 }
 
+/*
 func TestInstance_Get_MonthlyTransfer(t *testing.T) {
 	if strconv.IntSize < 64 {
 		t.Skip("V1 monthly transfer doesn't work on 32 or lower bits system")
@@ -133,6 +133,7 @@ func TestInstance_Get_MonthlyTransfer(t *testing.T) {
 	assert.Equal(t, 22956600198, stats.BytesOut)
 	assert.Equal(t, 53427677318, stats.BytesTotal)
 }
+*/
 
 func TestInstance_Get_MonthlyTransferV2(t *testing.T) {
 	fixtureData, err := fixtures.GetFixture("instance_monthly_transfer_get")
diff --git a/test/unit/mysql_64bit_test.go b/test/unit/mysql_64bit_test.go
new file mode 100644
index 0000000..2041de3
--- /dev/null
+++ b/test/unit/mysql_64bit_test.go
@@ -0,0 +1,268 @@
+//go:build !(386 || arm)
+
+package unit
+
+import (
+	"context"
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestDatabaseMySQLConfig_Get(t *testing.T) {
+	fixtureData, err := fixtures.GetFixture("mysql_database_config_get")
+	assert.NoError(t, err)
+
+	var base ClientBaseCase
+	base.SetUp(t)
+	defer base.TearDown(t)
+
+	base.MockGet("databases/mysql/config", fixtureData)
+
+	config, err := base.Client.GetMySQLDatabaseConfig(context.Background())
+	assert.NoError(t, err)
+
+	assert.Equal(t, "The number of seconds that the mysqld server waits for a connect packet before responding with Bad handshake",
+		config.MySQL.ConnectTimeout.Description)
+	assert.Equal(t, 10, config.MySQL.ConnectTimeout.Example)
+	assert.Equal(t, 3600, config.MySQL.ConnectTimeout.Maximum)
+	assert.Equal(t, 2, config.MySQL.ConnectTimeout.Minimum)
+	assert.False(t, config.MySQL.ConnectTimeout.RequiresRestart)
+	assert.Equal(t, "integer", config.MySQL.ConnectTimeout.Type)
+
+	assert.Equal(t, "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.Equal(t, "+03:00", config.MySQL.DefaultTimeZone.Example)
+	assert.Equal(t, 100, config.MySQL.DefaultTimeZone.MaxLength)
+	assert.Equal(t, 2, config.MySQL.DefaultTimeZone.MinLength)
+	assert.Equal(t, "^([-+][\\d:]*|[\\w/]*)$", config.MySQL.DefaultTimeZone.Pattern)
+	assert.False(t, config.MySQL.DefaultTimeZone.RequiresRestart)
+	assert.Equal(t, "string", config.MySQL.DefaultTimeZone.Type)
+
+	assert.Equal(t, "The maximum permitted result length in bytes for the GROUP_CONCAT() function.",
+		config.MySQL.GroupConcatMaxLen.Description)
+	assert.Equal(t, float64(1024), config.MySQL.GroupConcatMaxLen.Example)
+	assert.Equal(t, float64(18446744073709551600), config.MySQL.GroupConcatMaxLen.Maximum)
+	assert.Equal(t, float64(4), config.MySQL.GroupConcatMaxLen.Minimum)
+	assert.False(t, config.MySQL.GroupConcatMaxLen.RequiresRestart)
+	assert.Equal(t, "integer", config.MySQL.GroupConcatMaxLen.Type)
+
+	assert.Equal(t, "The time, in seconds, before cached statistics expire",
+		config.MySQL.InformationSchemaStatsExpiry.Description)
+	assert.Equal(t, 86400, config.MySQL.InformationSchemaStatsExpiry.Example)
+	assert.Equal(t, 31536000, config.MySQL.InformationSchemaStatsExpiry.Maximum)
+	assert.Equal(t, 900, config.MySQL.InformationSchemaStatsExpiry.Minimum)
+	assert.False(t, config.MySQL.InformationSchemaStatsExpiry.RequiresRestart)
+	assert.Equal(t, "integer", config.MySQL.InformationSchemaStatsExpiry.Type)
+
+	assert.Equal(t, "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.Equal(t, 30, config.MySQL.InnoDBChangeBufferMaxSize.Example)
+	assert.Equal(t, 50, config.MySQL.InnoDBChangeBufferMaxSize.Maximum)
+	assert.Equal(t, 0, config.MySQL.InnoDBChangeBufferMaxSize.Minimum)
+	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, 0, config.MySQL.InnoDBFlushNeighbors.Example)
+	assert.Equal(t, 2, config.MySQL.InnoDBFlushNeighbors.Maximum)
+	assert.Equal(t, 0, config.MySQL.InnoDBFlushNeighbors.Minimum)
+	assert.False(t, config.MySQL.InnoDBFlushNeighbors.RequiresRestart)
+	assert.Equal(t, "integer", config.MySQL.InnoDBFlushNeighbors.Type)
+
+	assert.Equal(t, "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.Equal(t, 3, config.MySQL.InnoDBFTMinTokenSize.Example)
+	assert.Equal(t, 16, config.MySQL.InnoDBFTMinTokenSize.Maximum)
+	assert.Equal(t, 0, config.MySQL.InnoDBFTMinTokenSize.Minimum)
+	assert.True(t, config.MySQL.InnoDBFTMinTokenSize.RequiresRestart)
+	assert.Equal(t, "integer", config.MySQL.InnoDBFTMinTokenSize.Type)
+
+	assert.Equal(t, "This option is used to specify your own InnoDB FULLTEXT index stopword list for all InnoDB tables.",
+		config.MySQL.InnoDBFTServerStopwordTable.Description)
+	assert.Equal(t, "db_name/table_name", config.MySQL.InnoDBFTServerStopwordTable.Example)
+	assert.Equal(t, 1024, config.MySQL.InnoDBFTServerStopwordTable.MaxLength)
+	assert.Equal(t, "^.+/.+$", config.MySQL.InnoDBFTServerStopwordTable.Pattern)
+	assert.False(t, config.MySQL.InnoDBFTServerStopwordTable.RequiresRestart)
+	assert.Equal(t, []string{"null", "string"}, config.MySQL.InnoDBFTServerStopwordTable.Type)
+
+	assert.Equal(t, "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.Equal(t, 50, config.MySQL.InnoDBLockWaitTimeout.Example)
+	assert.Equal(t, 3600, config.MySQL.InnoDBLockWaitTimeout.Maximum)
+	assert.Equal(t, 1, config.MySQL.InnoDBLockWaitTimeout.Minimum)
+	assert.False(t, config.MySQL.InnoDBLockWaitTimeout.RequiresRestart)
+	assert.Equal(t, "integer", config.MySQL.InnoDBLockWaitTimeout.Type)
+
+	assert.Equal(t, "The size in bytes of the buffer that InnoDB uses to write to the log files on disk.",
+		config.MySQL.InnoDBLogBufferSize.Description)
+	assert.Equal(t, 16777216, config.MySQL.InnoDBLogBufferSize.Example)
+	assert.Equal(t, 4294967295, config.MySQL.InnoDBLogBufferSize.Maximum)
+	assert.Equal(t, 1048576, config.MySQL.InnoDBLogBufferSize.Minimum)
+	assert.False(t, config.MySQL.InnoDBLogBufferSize.RequiresRestart)
+	assert.Equal(t, "integer", config.MySQL.InnoDBLogBufferSize.Type)
+
+	assert.Equal(t, "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.Equal(t, 134217728, config.MySQL.InnoDBOnlineAlterLogMaxSize.Example)
+	assert.Equal(t, 1099511627776, config.MySQL.InnoDBOnlineAlterLogMaxSize.Maximum)
+	assert.Equal(t, 65536, config.MySQL.InnoDBOnlineAlterLogMaxSize.Minimum)
+	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, 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, true, config.MySQL.InnoDBRollbackOnTimeout.Example)
+	assert.True(t, config.MySQL.InnoDBRollbackOnTimeout.RequiresRestart)
+	assert.Equal(t, "boolean", config.MySQL.InnoDBRollbackOnTimeout.Type)
+
+	assert.Equal(t, "Defines the maximum number of threads permitted inside of InnoDB. Default is 0 (infinite concurrency - no limit)",
+		config.MySQL.InnoDBThreadConcurrency.Description)
+	assert.Equal(t, 10, config.MySQL.InnoDBThreadConcurrency.Example)
+	assert.Equal(t, 1000, config.MySQL.InnoDBThreadConcurrency.Maximum)
+	assert.Equal(t, 0, config.MySQL.InnoDBThreadConcurrency.Minimum)
+	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, 10, config.MySQL.InnoDBWriteIOThreads.Example)
+	assert.Equal(t, 64, config.MySQL.InnoDBWriteIOThreads.Maximum)
+	assert.Equal(t, 1, config.MySQL.InnoDBWriteIOThreads.Minimum)
+	assert.True(t, config.MySQL.InnoDBWriteIOThreads.RequiresRestart)
+	assert.Equal(t, "integer", config.MySQL.InnoDBWriteIOThreads.Type)
+
+	assert.Equal(t, "The number of seconds the server waits for activity on an interactive connection before closing it.",
+		config.MySQL.InteractiveTimeout.Description)
+	assert.Equal(t, 3600, config.MySQL.InteractiveTimeout.Example)
+	assert.Equal(t, 604800, config.MySQL.InteractiveTimeout.Maximum)
+	assert.Equal(t, 30, config.MySQL.InteractiveTimeout.Minimum)
+	assert.False(t, config.MySQL.InteractiveTimeout.RequiresRestart)
+	assert.Equal(t, "integer", config.MySQL.InteractiveTimeout.Type)
+
+	assert.Equal(t, "The storage engine for in-memory internal temporary tables.",
+		config.MySQL.InternalTmpMemStorageEngine.Description)
+	assert.Equal(t, "TempTable", config.MySQL.InternalTmpMemStorageEngine.Example)
+	assert.Equal(t, []string{"TempTable", "MEMORY"}, config.MySQL.InternalTmpMemStorageEngine.Enum)
+	assert.False(t, config.MySQL.InternalTmpMemStorageEngine.RequiresRestart)
+	assert.Equal(t, "string", config.MySQL.InternalTmpMemStorageEngine.Type)
+
+	assert.Equal(t, "Size of the largest message in bytes that can be received by the server. Default is 67108864 (64M)",
+		config.MySQL.MaxAllowedPacket.Description)
+	assert.Equal(t, 67108864, config.MySQL.MaxAllowedPacket.Example)
+	assert.Equal(t, 1073741824, config.MySQL.MaxAllowedPacket.Maximum)
+	assert.Equal(t, 102400, config.MySQL.MaxAllowedPacket.Minimum)
+	assert.False(t, config.MySQL.MaxAllowedPacket.RequiresRestart)
+	assert.Equal(t, "integer", config.MySQL.MaxAllowedPacket.Type)
+
+	assert.Equal(t, "Limits the size of internal in-memory tables. Also set tmp_table_size. Default is 16777216 (16M)",
+		config.MySQL.MaxHeapTableSize.Description)
+	assert.Equal(t, 16777216, config.MySQL.MaxHeapTableSize.Example)
+	assert.Equal(t, 1073741824, config.MySQL.MaxHeapTableSize.Maximum)
+	assert.Equal(t, 1048576, config.MySQL.MaxHeapTableSize.Minimum)
+	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, 16384, config.MySQL.NetBufferLength.Example)
+	assert.Equal(t, 1048576, config.MySQL.NetBufferLength.Maximum)
+	assert.Equal(t, 1024, config.MySQL.NetBufferLength.Minimum)
+	assert.True(t, config.MySQL.NetBufferLength.RequiresRestart)
+	assert.Equal(t, "integer", config.MySQL.NetBufferLength.Type)
+
+	assert.Equal(t, "The number of seconds to wait for more data from a connection before aborting the read.",
+		config.MySQL.NetReadTimeout.Description)
+	assert.Equal(t, 30, config.MySQL.NetReadTimeout.Example)
+	assert.Equal(t, 3600, config.MySQL.NetReadTimeout.Maximum)
+	assert.Equal(t, 1, config.MySQL.NetReadTimeout.Minimum)
+	assert.False(t, config.MySQL.NetReadTimeout.RequiresRestart)
+	assert.Equal(t, "integer", config.MySQL.NetReadTimeout.Type)
+
+	assert.Equal(t, "The number of seconds to wait for a block to be written to a connection before aborting the write.",
+		config.MySQL.NetWriteTimeout.Description)
+	assert.Equal(t, 30, config.MySQL.NetWriteTimeout.Example)
+	assert.Equal(t, 3600, config.MySQL.NetWriteTimeout.Maximum)
+	assert.Equal(t, 1, config.MySQL.NetWriteTimeout.Minimum)
+	assert.False(t, config.MySQL.NetWriteTimeout.RequiresRestart)
+	assert.Equal(t, "integer", config.MySQL.NetWriteTimeout.Type)
+
+	assert.Equal(t, "Sort buffer size in bytes for ORDER BY optimization. Default is 262144 (256K)",
+		config.MySQL.SortBufferSize.Description)
+	assert.Equal(t, 262144, config.MySQL.SortBufferSize.Example)
+	assert.Equal(t, 1073741824, config.MySQL.SortBufferSize.Maximum)
+	assert.Equal(t, 32768, config.MySQL.SortBufferSize.Minimum)
+	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, "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, true, config.MySQL.SQLRequirePrimaryKey.Example)
+	assert.False(t, config.MySQL.SQLRequirePrimaryKey.RequiresRestart)
+	assert.Equal(t, "boolean", config.MySQL.SQLRequirePrimaryKey.Type)
+
+	assert.Equal(t, "Limits the size of internal in-memory tables. Also set max_heap_table_size. Default is 16777216 (16M)",
+		config.MySQL.TmpTableSize.Description)
+	assert.Equal(t, 16777216, config.MySQL.TmpTableSize.Example)
+	assert.Equal(t, 1073741824, config.MySQL.TmpTableSize.Maximum)
+	assert.Equal(t, 1048576, config.MySQL.TmpTableSize.Minimum)
+	assert.False(t, config.MySQL.TmpTableSize.RequiresRestart)
+	assert.Equal(t, "integer", config.MySQL.TmpTableSize.Type)
+
+	assert.Equal(t, "The number of seconds the server waits for activity on a noninteractive connection before closing it.",
+		config.MySQL.WaitTimeout.Description)
+	assert.Equal(t, 28800, config.MySQL.WaitTimeout.Example)
+	assert.Equal(t, 2147483, config.MySQL.WaitTimeout.Maximum)
+	assert.Equal(t, 1, config.MySQL.WaitTimeout.Minimum)
+	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, 600, config.BinlogRetentionPeriod.Example)
+	assert.Equal(t, 86400, config.BinlogRetentionPeriod.Maximum)
+	assert.Equal(t, 600, config.BinlogRetentionPeriod.Minimum)
+	assert.False(t, config.BinlogRetentionPeriod.RequiresRestart)
+	assert.Equal(t, "integer", config.BinlogRetentionPeriod.Type)
+}
diff --git a/test/unit/mysql_test.go b/test/unit/mysql_test.go
index 94b99a2..53c75c4 100644
--- a/test/unit/mysql_test.go
+++ b/test/unit/mysql_test.go
@@ -309,6 +309,7 @@ func TestDatabaseMySQL_Resume(t *testing.T) {
 	}
 }
 
+/*
 func TestDatabaseMySQLConfig_Get(t *testing.T) {
 	fixtureData, err := fixtures.GetFixture("mysql_database_config_get")
 	assert.NoError(t, err)
@@ -566,3 +567,4 @@ func TestDatabaseMySQLConfig_Get(t *testing.T) {
 	assert.False(t, config.BinlogRetentionPeriod.RequiresRestart)
 	assert.Equal(t, "integer", config.BinlogRetentionPeriod.Type)
 }
+*/
