blob: c746b6a56d0996dbb477af95a75fe35c8b05e5f1 [file] [log] [blame]
Jamie Hannaford936a5472015-02-10 14:38:28 +01001package instances
2
3import (
4 "testing"
5
6 th "github.com/rackspace/gophercloud/testhelper"
7 fake "github.com/rackspace/gophercloud/testhelper/client"
8)
9
10func TestGetConfig(t *testing.T) {
11 th.SetupHTTP()
12 defer th.TeardownHTTP()
13
Jamie Hannafordf77fc102015-02-10 14:56:02 +010014 HandleGetConfigSuccessfully(t, instanceID)
Jamie Hannaford936a5472015-02-10 14:38:28 +010015
Jamie Hannafordf77fc102015-02-10 14:56:02 +010016 config, err := GetDefaultConfig(fake.ServiceClient(), instanceID).Extract()
Jamie Hannaford936a5472015-02-10 14:38:28 +010017
18 expected := map[string]string{
19 "basedir": "/usr",
20 "connect_timeout": "15",
21 "datadir": "/var/lib/mysql",
22 "default_storage_engine": "innodb",
23 "innodb_buffer_pool_instances": "1",
24 "innodb_buffer_pool_size": "175M",
25 "innodb_checksum_algorithm": "crc32",
26 "innodb_data_file_path": "ibdata1:10M:autoextend",
27 "innodb_file_per_table": "1",
28 "innodb_io_capacity": "200",
29 "innodb_log_file_size": "256M",
30 "innodb_log_files_in_group": "2",
31 "innodb_open_files": "8192",
32 "innodb_thread_concurrency": "0",
33 "join_buffer_size": "1M",
34 "key_buffer_size": "50M",
35 "local-infile": "0",
36 "log-error": "/var/log/mysql/mysqld.log",
37 "max_allowed_packet": "16M",
38 "max_connect_errors": "10000",
39 "max_connections": "40",
40 "max_heap_table_size": "16M",
41 "myisam-recover": "BACKUP",
42 "open_files_limit": "8192",
43 "performance_schema": "off",
44 "pid_file": "/var/run/mysqld/mysqld.pid",
45 "port": "3306",
46 "query_cache_limit": "1M",
47 "query_cache_size": "8M",
48 "query_cache_type": "1",
49 "read_buffer_size": "256K",
50 "read_rnd_buffer_size": "1M",
51 "server_id": "1",
52 "skip-external-locking": "1",
53 "skip_name_resolve": "1",
54 "sort_buffer_size": "256K",
55 "table_open_cache": "4096",
56 "thread_stack": "192K",
57 "tmp_table_size": "16M",
58 "tmpdir": "/var/tmp",
59 "user": "mysql",
60 "wait_timeout": "3600",
61 }
62
63 th.AssertNoErr(t, err)
64 th.AssertDeepEquals(t, expected, config)
65}
Jamie Hannafordf77fc102015-02-10 14:56:02 +010066
67func TestAssociateWithConfigGroup(t *testing.T) {
68 th.SetupHTTP()
69 defer th.TeardownHTTP()
70
71 HandleAssociateGroupSuccessfully(t, instanceID)
72
73 configGroupID := "{configGroupID}"
74 res := AssociateWithConfigGroup(fake.ServiceClient(), instanceID, configGroupID)
75 th.AssertNoErr(t, res.Err)
76}