forked from linode/linode_api4-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase_test.py
More file actions
1454 lines (1354 loc) · 61.1 KB
/
database_test.py
File metadata and controls
1454 lines (1354 loc) · 61.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import logging
from test.unit.base import ClientBaseCase
from linode_api4.objects import MySQLDatabase
logger = logging.getLogger(__name__)
class DatabaseTest(ClientBaseCase):
"""
Tests methods of the DatabaseGroup class
"""
def test_get_types(self):
"""
Test that database types are properly handled
"""
types = self.client.database.types()
self.assertEqual(len(types), 1)
self.assertEqual(types[0].type_class, "nanode")
self.assertEqual(types[0].id, "g6-nanode-1")
self.assertEqual(types[0].engines.mysql[0].price.monthly, 20)
def test_get_engines(self):
"""
Test that database engines are properly handled
"""
engines = self.client.database.engines()
self.assertEqual(len(engines), 2)
self.assertEqual(engines[0].engine, "mysql")
self.assertEqual(engines[0].id, "mysql/8.0.26")
self.assertEqual(engines[0].version, "8.0.26")
self.assertEqual(engines[1].engine, "postgresql")
self.assertEqual(engines[1].id, "postgresql/10.14")
self.assertEqual(engines[1].version, "10.14")
def test_get_databases(self):
"""
Test that databases are properly handled
"""
dbs = self.client.database.instances()
self.assertEqual(len(dbs), 1)
self.assertEqual(dbs[0].allow_list[1], "192.0.1.0/24")
self.assertEqual(dbs[0].cluster_size, 3)
self.assertEqual(dbs[0].encrypted, False)
self.assertEqual(dbs[0].engine, "mysql")
self.assertEqual(
dbs[0].hosts.primary,
"lin-123-456-mysql-mysql-primary.servers.linodedb.net",
)
self.assertEqual(
dbs[0].hosts.secondary,
"lin-123-456-mysql-primary-private.servers.linodedb.net",
)
self.assertEqual(dbs[0].id, 123)
self.assertEqual(dbs[0].region, "us-east")
self.assertEqual(dbs[0].updates.duration, 3)
self.assertEqual(dbs[0].version, "8.0.26")
def test_database_instance(self):
"""
Ensures that the .instance attribute properly translates database types
"""
dbs = self.client.database.instances()
db_translated = dbs[0].instance
self.assertTrue(isinstance(db_translated, MySQLDatabase))
self.assertEqual(db_translated.ssl_connection, True)
def test_mysql_config_options(self):
"""
Test that MySQL configuration options can be retrieved
"""
config = self.client.database.mysql_config_options()
self.assertEqual(
"The number of seconds that the mysqld server waits for a connect packet before responding with Bad handshake",
config["mysql"]["connect_timeout"]["description"],
)
self.assertEqual(10, config["mysql"]["connect_timeout"]["example"])
self.assertEqual(3600, config["mysql"]["connect_timeout"]["maximum"])
self.assertEqual(2, config["mysql"]["connect_timeout"]["minimum"])
self.assertFalse(config["mysql"]["connect_timeout"]["requires_restart"])
self.assertEqual("integer", config["mysql"]["connect_timeout"]["type"])
self.assertEqual(
"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"]["default_time_zone"]["description"],
)
self.assertEqual(
"+03:00", config["mysql"]["default_time_zone"]["example"]
)
self.assertEqual(100, config["mysql"]["default_time_zone"]["maxLength"])
self.assertEqual(2, config["mysql"]["default_time_zone"]["minLength"])
self.assertEqual(
"^([-+][\\d:]*|[\\w/]*)$",
config["mysql"]["default_time_zone"]["pattern"],
)
self.assertFalse(
config["mysql"]["default_time_zone"]["requires_restart"]
)
self.assertEqual("string", config["mysql"]["default_time_zone"]["type"])
self.assertEqual(
"The maximum permitted result length in bytes for the GROUP_CONCAT() function.",
config["mysql"]["group_concat_max_len"]["description"],
)
self.assertEqual(
1024, config["mysql"]["group_concat_max_len"]["example"]
)
self.assertEqual(
18446744073709551600,
config["mysql"]["group_concat_max_len"]["maximum"],
)
self.assertEqual(4, config["mysql"]["group_concat_max_len"]["minimum"])
self.assertFalse(
config["mysql"]["group_concat_max_len"]["requires_restart"]
)
self.assertEqual(
"integer", config["mysql"]["group_concat_max_len"]["type"]
)
self.assertEqual(
"The time, in seconds, before cached statistics expire",
config["mysql"]["information_schema_stats_expiry"]["description"],
)
self.assertEqual(
86400, config["mysql"]["information_schema_stats_expiry"]["example"]
)
self.assertEqual(
31536000,
config["mysql"]["information_schema_stats_expiry"]["maximum"],
)
self.assertEqual(
900, config["mysql"]["information_schema_stats_expiry"]["minimum"]
)
self.assertFalse(
config["mysql"]["information_schema_stats_expiry"][
"requires_restart"
]
)
self.assertEqual(
"integer",
config["mysql"]["information_schema_stats_expiry"]["type"],
)
self.assertEqual(
"Maximum size for the InnoDB change buffer, as a percentage of the total size of the buffer pool. Default is 25",
config["mysql"]["innodb_change_buffer_max_size"]["description"],
)
self.assertEqual(
30, config["mysql"]["innodb_change_buffer_max_size"]["example"]
)
self.assertEqual(
50, config["mysql"]["innodb_change_buffer_max_size"]["maximum"]
)
self.assertEqual(
0, config["mysql"]["innodb_change_buffer_max_size"]["minimum"]
)
self.assertFalse(
config["mysql"]["innodb_change_buffer_max_size"]["requires_restart"]
)
self.assertEqual(
"integer", config["mysql"]["innodb_change_buffer_max_size"]["type"]
)
self.assertEqual(
"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"]["innodb_flush_neighbors"]["description"],
)
self.assertEqual(
0, config["mysql"]["innodb_flush_neighbors"]["example"]
)
self.assertEqual(
2, config["mysql"]["innodb_flush_neighbors"]["maximum"]
)
self.assertEqual(
0, config["mysql"]["innodb_flush_neighbors"]["minimum"]
)
self.assertFalse(
config["mysql"]["innodb_flush_neighbors"]["requires_restart"]
)
self.assertEqual(
"integer", config["mysql"]["innodb_flush_neighbors"]["type"]
)
self.assertEqual(
"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"]["innodb_ft_min_token_size"]["description"],
)
self.assertEqual(
3, config["mysql"]["innodb_ft_min_token_size"]["example"]
)
self.assertEqual(
16, config["mysql"]["innodb_ft_min_token_size"]["maximum"]
)
self.assertEqual(
0, config["mysql"]["innodb_ft_min_token_size"]["minimum"]
)
self.assertTrue(
config["mysql"]["innodb_ft_min_token_size"]["requires_restart"]
)
self.assertEqual(
"integer", config["mysql"]["innodb_ft_min_token_size"]["type"]
)
self.assertEqual(
"This option is used to specify your own InnoDB FULLTEXT index stopword list for all InnoDB tables.",
config["mysql"]["innodb_ft_server_stopword_table"]["description"],
)
self.assertEqual(
"db_name/table_name",
config["mysql"]["innodb_ft_server_stopword_table"]["example"],
)
self.assertEqual(
1024,
config["mysql"]["innodb_ft_server_stopword_table"]["maxLength"],
)
self.assertEqual(
"^.+/.+$",
config["mysql"]["innodb_ft_server_stopword_table"]["pattern"],
)
self.assertFalse(
config["mysql"]["innodb_ft_server_stopword_table"][
"requires_restart"
]
)
self.assertEqual(
["null", "string"],
config["mysql"]["innodb_ft_server_stopword_table"]["type"],
)
self.assertEqual(
"The length of time in seconds an InnoDB transaction waits for a row lock before giving up. Default is 120.",
config["mysql"]["innodb_lock_wait_timeout"]["description"],
)
self.assertEqual(
50, config["mysql"]["innodb_lock_wait_timeout"]["example"]
)
self.assertEqual(
3600, config["mysql"]["innodb_lock_wait_timeout"]["maximum"]
)
self.assertEqual(
1, config["mysql"]["innodb_lock_wait_timeout"]["minimum"]
)
self.assertFalse(
config["mysql"]["innodb_lock_wait_timeout"]["requires_restart"]
)
self.assertEqual(
"integer", config["mysql"]["innodb_lock_wait_timeout"]["type"]
)
self.assertEqual(
"The size in bytes of the buffer that InnoDB uses to write to the log files on disk.",
config["mysql"]["innodb_log_buffer_size"]["description"],
)
self.assertEqual(
16777216, config["mysql"]["innodb_log_buffer_size"]["example"]
)
self.assertEqual(
4294967295, config["mysql"]["innodb_log_buffer_size"]["maximum"]
)
self.assertEqual(
1048576, config["mysql"]["innodb_log_buffer_size"]["minimum"]
)
self.assertFalse(
config["mysql"]["innodb_log_buffer_size"]["requires_restart"]
)
self.assertEqual(
"integer", config["mysql"]["innodb_log_buffer_size"]["type"]
)
self.assertEqual(
"The upper limit in bytes on the size of the temporary log files used during online DDL operations for InnoDB tables.",
config["mysql"]["innodb_online_alter_log_max_size"]["description"],
)
self.assertEqual(
134217728,
config["mysql"]["innodb_online_alter_log_max_size"]["example"],
)
self.assertEqual(
1099511627776,
config["mysql"]["innodb_online_alter_log_max_size"]["maximum"],
)
self.assertEqual(
65536,
config["mysql"]["innodb_online_alter_log_max_size"]["minimum"],
)
self.assertFalse(
config["mysql"]["innodb_online_alter_log_max_size"][
"requires_restart"
]
)
self.assertEqual(
"integer",
config["mysql"]["innodb_online_alter_log_max_size"]["type"],
)
self.assertEqual(
"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"]["innodb_read_io_threads"]["description"],
)
self.assertEqual(
10, config["mysql"]["innodb_read_io_threads"]["example"]
)
self.assertEqual(
64, config["mysql"]["innodb_read_io_threads"]["maximum"]
)
self.assertEqual(
1, config["mysql"]["innodb_read_io_threads"]["minimum"]
)
self.assertTrue(
config["mysql"]["innodb_read_io_threads"]["requires_restart"]
)
self.assertEqual(
"integer", config["mysql"]["innodb_read_io_threads"]["type"]
)
self.assertEqual(
"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"]["innodb_rollback_on_timeout"]["description"],
)
self.assertTrue(
config["mysql"]["innodb_rollback_on_timeout"]["example"]
)
self.assertTrue(
config["mysql"]["innodb_rollback_on_timeout"]["requires_restart"]
)
self.assertEqual(
"boolean", config["mysql"]["innodb_rollback_on_timeout"]["type"]
)
self.assertEqual(
"Defines the maximum number of threads permitted inside of InnoDB. Default is 0 (infinite concurrency - no limit)",
config["mysql"]["innodb_thread_concurrency"]["description"],
)
self.assertEqual(
10, config["mysql"]["innodb_thread_concurrency"]["example"]
)
self.assertEqual(
1000, config["mysql"]["innodb_thread_concurrency"]["maximum"]
)
self.assertEqual(
0, config["mysql"]["innodb_thread_concurrency"]["minimum"]
)
self.assertFalse(
config["mysql"]["innodb_thread_concurrency"]["requires_restart"]
)
self.assertEqual(
"integer", config["mysql"]["innodb_thread_concurrency"]["type"]
)
self.assertEqual(
"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"]["innodb_write_io_threads"]["description"],
)
self.assertEqual(
10, config["mysql"]["innodb_write_io_threads"]["example"]
)
self.assertEqual(
64, config["mysql"]["innodb_write_io_threads"]["maximum"]
)
self.assertEqual(
1, config["mysql"]["innodb_write_io_threads"]["minimum"]
)
self.assertTrue(
config["mysql"]["innodb_write_io_threads"]["requires_restart"]
)
self.assertEqual(
"integer", config["mysql"]["innodb_write_io_threads"]["type"]
)
self.assertEqual(
"The number of seconds the server waits for activity on an interactive connection before closing it.",
config["mysql"]["interactive_timeout"]["description"],
)
self.assertEqual(
3600, config["mysql"]["interactive_timeout"]["example"]
)
self.assertEqual(
604800, config["mysql"]["interactive_timeout"]["maximum"]
)
self.assertEqual(30, config["mysql"]["interactive_timeout"]["minimum"])
self.assertFalse(
config["mysql"]["interactive_timeout"]["requires_restart"]
)
self.assertEqual(
"integer", config["mysql"]["interactive_timeout"]["type"]
)
self.assertEqual(
"The storage engine for in-memory internal temporary tables.",
config["mysql"]["internal_tmp_mem_storage_engine"]["description"],
)
self.assertEqual(
"TempTable",
config["mysql"]["internal_tmp_mem_storage_engine"]["example"],
)
self.assertEqual(
["TempTable", "MEMORY"],
config["mysql"]["internal_tmp_mem_storage_engine"]["enum"],
)
self.assertFalse(
config["mysql"]["internal_tmp_mem_storage_engine"][
"requires_restart"
]
)
self.assertEqual(
"string", config["mysql"]["internal_tmp_mem_storage_engine"]["type"]
)
self.assertEqual(
"Size of the largest message in bytes that can be received by the server. Default is 67108864 (64M)",
config["mysql"]["max_allowed_packet"]["description"],
)
self.assertEqual(
67108864, config["mysql"]["max_allowed_packet"]["example"]
)
self.assertEqual(
1073741824, config["mysql"]["max_allowed_packet"]["maximum"]
)
self.assertEqual(
102400, config["mysql"]["max_allowed_packet"]["minimum"]
)
self.assertFalse(
config["mysql"]["max_allowed_packet"]["requires_restart"]
)
self.assertEqual(
"integer", config["mysql"]["max_allowed_packet"]["type"]
)
self.assertEqual(
"Limits the size of internal in-memory tables. Also set tmp_table_size. Default is 16777216 (16M)",
config["mysql"]["max_heap_table_size"]["description"],
)
self.assertEqual(
16777216, config["mysql"]["max_heap_table_size"]["example"]
)
self.assertEqual(
1073741824, config["mysql"]["max_heap_table_size"]["maximum"]
)
self.assertEqual(
1048576, config["mysql"]["max_heap_table_size"]["minimum"]
)
self.assertFalse(
config["mysql"]["max_heap_table_size"]["requires_restart"]
)
self.assertEqual(
"integer", config["mysql"]["max_heap_table_size"]["type"]
)
self.assertEqual(
"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"]["net_buffer_length"]["description"],
)
self.assertEqual(16384, config["mysql"]["net_buffer_length"]["example"])
self.assertEqual(
1048576, config["mysql"]["net_buffer_length"]["maximum"]
)
self.assertEqual(1024, config["mysql"]["net_buffer_length"]["minimum"])
self.assertTrue(
config["mysql"]["net_buffer_length"]["requires_restart"]
)
self.assertEqual(
"integer", config["mysql"]["net_buffer_length"]["type"]
)
self.assertEqual(
"The number of seconds to wait for more data from a connection before aborting the read.",
config["mysql"]["net_read_timeout"]["description"],
)
self.assertEqual(30, config["mysql"]["net_read_timeout"]["example"])
self.assertEqual(3600, config["mysql"]["net_read_timeout"]["maximum"])
self.assertEqual(1, config["mysql"]["net_read_timeout"]["minimum"])
self.assertFalse(
config["mysql"]["net_read_timeout"]["requires_restart"]
)
self.assertEqual("integer", config["mysql"]["net_read_timeout"]["type"])
self.assertEqual(
"The number of seconds to wait for a block to be written to a connection before aborting the write.",
config["mysql"]["net_write_timeout"]["description"],
)
self.assertEqual(30, config["mysql"]["net_write_timeout"]["example"])
self.assertEqual(3600, config["mysql"]["net_write_timeout"]["maximum"])
self.assertEqual(1, config["mysql"]["net_write_timeout"]["minimum"])
self.assertFalse(
config["mysql"]["net_write_timeout"]["requires_restart"]
)
self.assertEqual(
"integer", config["mysql"]["net_write_timeout"]["type"]
)
self.assertEqual(
"Sort buffer size in bytes for ORDER BY optimization. Default is 262144 (256K)",
config["mysql"]["sort_buffer_size"]["description"],
)
self.assertEqual(262144, config["mysql"]["sort_buffer_size"]["example"])
self.assertEqual(
1073741824, config["mysql"]["sort_buffer_size"]["maximum"]
)
self.assertEqual(32768, config["mysql"]["sort_buffer_size"]["minimum"])
self.assertFalse(
config["mysql"]["sort_buffer_size"]["requires_restart"]
)
self.assertEqual("integer", config["mysql"]["sort_buffer_size"]["type"])
self.assertEqual(
"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"]["sql_mode"]["description"],
)
self.assertEqual(
"ANSI,TRADITIONAL", config["mysql"]["sql_mode"]["example"]
)
self.assertEqual(1024, config["mysql"]["sql_mode"]["maxLength"])
self.assertEqual(
"^[A-Z_]*(,[A-Z_]+)*$", config["mysql"]["sql_mode"]["pattern"]
)
self.assertFalse(config["mysql"]["sql_mode"]["requires_restart"])
self.assertEqual("string", config["mysql"]["sql_mode"]["type"])
self.assertEqual(
"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"]["sql_require_primary_key"]["description"],
)
self.assertTrue(config["mysql"]["sql_require_primary_key"]["example"])
self.assertFalse(
config["mysql"]["sql_require_primary_key"]["requires_restart"]
)
self.assertEqual(
"boolean", config["mysql"]["sql_require_primary_key"]["type"]
)
self.assertEqual(
"Limits the size of internal in-memory tables. Also set max_heap_table_size. Default is 16777216 (16M)",
config["mysql"]["tmp_table_size"]["description"],
)
self.assertEqual(16777216, config["mysql"]["tmp_table_size"]["example"])
self.assertEqual(
1073741824, config["mysql"]["tmp_table_size"]["maximum"]
)
self.assertEqual(1048576, config["mysql"]["tmp_table_size"]["minimum"])
self.assertFalse(config["mysql"]["tmp_table_size"]["requires_restart"])
self.assertEqual("integer", config["mysql"]["tmp_table_size"]["type"])
self.assertEqual(
"The number of seconds the server waits for activity on a noninteractive connection before closing it.",
config["mysql"]["wait_timeout"]["description"],
)
self.assertEqual(28800, config["mysql"]["wait_timeout"]["example"])
self.assertEqual(2147483, config["mysql"]["wait_timeout"]["maximum"])
self.assertEqual(1, config["mysql"]["wait_timeout"]["minimum"])
self.assertFalse(config["mysql"]["wait_timeout"]["requires_restart"])
self.assertEqual("integer", config["mysql"]["wait_timeout"]["type"])
self.assertEqual(
"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["binlog_retention_period"]["description"],
)
self.assertEqual(600, config["binlog_retention_period"]["example"])
self.assertEqual(86400, config["binlog_retention_period"]["maximum"])
self.assertEqual(600, config["binlog_retention_period"]["minimum"])
self.assertFalse(config["binlog_retention_period"]["requires_restart"])
self.assertEqual("integer", config["binlog_retention_period"]["type"])
def test_postgresql_config_options(self):
"""
Test that PostgreSQL configuration options can be retrieved
"""
config = self.client.database.postgresql_config_options()
self.assertEqual(
"Specifies a fraction of the table size to add to autovacuum_analyze_threshold when "
+ "deciding whether to trigger an ANALYZE. The default is 0.2 (20% of table size)",
config["pg"]["autovacuum_analyze_scale_factor"]["description"],
)
self.assertEqual(
1.0, config["pg"]["autovacuum_analyze_scale_factor"]["maximum"]
)
self.assertEqual(
0.0, config["pg"]["autovacuum_analyze_scale_factor"]["minimum"]
)
self.assertFalse(
config["pg"]["autovacuum_analyze_scale_factor"]["requires_restart"]
)
self.assertEqual(
"number", config["pg"]["autovacuum_analyze_scale_factor"]["type"]
)
self.assertEqual(
"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"]["autovacuum_analyze_threshold"]["description"],
)
self.assertEqual(
2147483647, config["pg"]["autovacuum_analyze_threshold"]["maximum"]
)
self.assertEqual(
0, config["pg"]["autovacuum_analyze_threshold"]["minimum"]
)
self.assertFalse(
config["pg"]["autovacuum_analyze_threshold"]["requires_restart"]
)
self.assertEqual(
"integer", config["pg"]["autovacuum_analyze_threshold"]["type"]
)
self.assertEqual(
"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"]["autovacuum_max_workers"]["description"],
)
self.assertEqual(20, config["pg"]["autovacuum_max_workers"]["maximum"])
self.assertEqual(1, config["pg"]["autovacuum_max_workers"]["minimum"])
self.assertFalse(
config["pg"]["autovacuum_max_workers"]["requires_restart"]
)
self.assertEqual(
"integer", config["pg"]["autovacuum_max_workers"]["type"]
)
self.assertEqual(
"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"]["autovacuum_naptime"]["description"],
)
self.assertEqual(86400, config["pg"]["autovacuum_naptime"]["maximum"])
self.assertEqual(1, config["pg"]["autovacuum_naptime"]["minimum"])
self.assertFalse(config["pg"]["autovacuum_naptime"]["requires_restart"])
self.assertEqual("integer", config["pg"]["autovacuum_naptime"]["type"])
self.assertEqual(
"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"]["autovacuum_vacuum_cost_delay"]["description"],
)
self.assertEqual(
100, config["pg"]["autovacuum_vacuum_cost_delay"]["maximum"]
)
self.assertEqual(
-1, config["pg"]["autovacuum_vacuum_cost_delay"]["minimum"]
)
self.assertFalse(
config["pg"]["autovacuum_vacuum_cost_delay"]["requires_restart"]
)
self.assertEqual(
"integer", config["pg"]["autovacuum_vacuum_cost_delay"]["type"]
)
self.assertEqual(
"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"]["autovacuum_vacuum_cost_limit"]["description"],
)
self.assertEqual(
10000, config["pg"]["autovacuum_vacuum_cost_limit"]["maximum"]
)
self.assertEqual(
-1, config["pg"]["autovacuum_vacuum_cost_limit"]["minimum"]
)
self.assertFalse(
config["pg"]["autovacuum_vacuum_cost_limit"]["requires_restart"]
)
self.assertEqual(
"integer", config["pg"]["autovacuum_vacuum_cost_limit"]["type"]
)
self.assertEqual(
"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"]["autovacuum_vacuum_scale_factor"]["description"],
)
self.assertEqual(
1.0, config["pg"]["autovacuum_vacuum_scale_factor"]["maximum"]
)
self.assertEqual(
0.0, config["pg"]["autovacuum_vacuum_scale_factor"]["minimum"]
)
self.assertFalse(
config["pg"]["autovacuum_vacuum_scale_factor"]["requires_restart"]
)
self.assertEqual(
"number", config["pg"]["autovacuum_vacuum_scale_factor"]["type"]
)
self.assertEqual(
"Specifies the minimum number of updated or deleted tuples needed to trigger a VACUUM in any one table. The default is 50 tuples",
config["pg"]["autovacuum_vacuum_threshold"]["description"],
)
self.assertEqual(
2147483647, config["pg"]["autovacuum_vacuum_threshold"]["maximum"]
)
self.assertEqual(
0, config["pg"]["autovacuum_vacuum_threshold"]["minimum"]
)
self.assertFalse(
config["pg"]["autovacuum_vacuum_threshold"]["requires_restart"]
)
self.assertEqual(
"integer", config["pg"]["autovacuum_vacuum_threshold"]["type"]
)
self.assertEqual(
"Specifies the delay between activity rounds for the background writer in milliseconds. Default is 200.",
config["pg"]["bgwriter_delay"]["description"],
)
self.assertEqual(200, config["pg"]["bgwriter_delay"]["example"])
self.assertEqual(10000, config["pg"]["bgwriter_delay"]["maximum"])
self.assertEqual(10, config["pg"]["bgwriter_delay"]["minimum"])
self.assertFalse(config["pg"]["bgwriter_delay"]["requires_restart"])
self.assertEqual("integer", config["pg"]["bgwriter_delay"]["type"])
self.assertEqual(
"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"]["bgwriter_flush_after"]["description"],
)
self.assertEqual(512, config["pg"]["bgwriter_flush_after"]["example"])
self.assertEqual(2048, config["pg"]["bgwriter_flush_after"]["maximum"])
self.assertEqual(0, config["pg"]["bgwriter_flush_after"]["minimum"])
self.assertFalse(
config["pg"]["bgwriter_flush_after"]["requires_restart"]
)
self.assertEqual(
"integer", config["pg"]["bgwriter_flush_after"]["type"]
)
self.assertEqual(
"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"]["bgwriter_lru_maxpages"]["description"],
)
self.assertEqual(100, config["pg"]["bgwriter_lru_maxpages"]["example"])
self.assertEqual(
1073741823, config["pg"]["bgwriter_lru_maxpages"]["maximum"]
)
self.assertEqual(0, config["pg"]["bgwriter_lru_maxpages"]["minimum"])
self.assertFalse(
config["pg"]["bgwriter_lru_maxpages"]["requires_restart"]
)
self.assertEqual(
"integer", config["pg"]["bgwriter_lru_maxpages"]["type"]
)
self.assertEqual(
"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"]["bgwriter_lru_multiplier"]["description"],
)
self.assertEqual(
2.0, config["pg"]["bgwriter_lru_multiplier"]["example"]
)
self.assertEqual(
10.0, config["pg"]["bgwriter_lru_multiplier"]["maximum"]
)
self.assertEqual(
0.0, config["pg"]["bgwriter_lru_multiplier"]["minimum"]
)
self.assertFalse(
config["pg"]["bgwriter_lru_multiplier"]["requires_restart"]
)
self.assertEqual(
"number", config["pg"]["bgwriter_lru_multiplier"]["type"]
)
self.assertEqual(
"This is the amount of time, in milliseconds, to wait on a lock before checking to see if there is a deadlock condition.",
config["pg"]["deadlock_timeout"]["description"],
)
self.assertEqual(1000, config["pg"]["deadlock_timeout"]["example"])
self.assertEqual(1800000, config["pg"]["deadlock_timeout"]["maximum"])
self.assertEqual(500, config["pg"]["deadlock_timeout"]["minimum"])
self.assertFalse(config["pg"]["deadlock_timeout"]["requires_restart"])
self.assertEqual("integer", config["pg"]["deadlock_timeout"]["type"])
self.assertEqual(
"Specifies the default TOAST compression method for values of compressible columns (the default is lz4).",
config["pg"]["default_toast_compression"]["description"],
)
self.assertEqual(
["lz4", "pglz"], config["pg"]["default_toast_compression"]["enum"]
)
self.assertEqual(
"lz4", config["pg"]["default_toast_compression"]["example"]
)
self.assertFalse(
config["pg"]["default_toast_compression"]["requires_restart"]
)
self.assertEqual(
"string", config["pg"]["default_toast_compression"]["type"]
)
self.assertEqual(
"Time out sessions with open transactions after this number of milliseconds",
config["pg"]["idle_in_transaction_session_timeout"]["description"],
)
self.assertEqual(
604800000,
config["pg"]["idle_in_transaction_session_timeout"]["maximum"],
)
self.assertEqual(
0, config["pg"]["idle_in_transaction_session_timeout"]["minimum"]
)
self.assertFalse(
config["pg"]["idle_in_transaction_session_timeout"][
"requires_restart"
]
)
self.assertEqual(
"integer",
config["pg"]["idle_in_transaction_session_timeout"]["type"],
)
self.assertEqual(
"Controls system-wide use of Just-in-Time Compilation (JIT).",
config["pg"]["jit"]["description"],
)
self.assertTrue(config["pg"]["jit"]["example"])
self.assertFalse(config["pg"]["jit"]["requires_restart"])
self.assertEqual("boolean", config["pg"]["jit"]["type"])
self.assertEqual(
"PostgreSQL maximum number of files that can be open per process",
config["pg"]["max_files_per_process"]["description"],
)
self.assertEqual(4096, config["pg"]["max_files_per_process"]["maximum"])
self.assertEqual(1000, config["pg"]["max_files_per_process"]["minimum"])
self.assertFalse(
config["pg"]["max_files_per_process"]["requires_restart"]
)
self.assertEqual(
"integer", config["pg"]["max_files_per_process"]["type"]
)
self.assertEqual(
"PostgreSQL maximum locks per transaction",
config["pg"]["max_locks_per_transaction"]["description"],
)
self.assertEqual(
6400, config["pg"]["max_locks_per_transaction"]["maximum"]
)
self.assertEqual(
64, config["pg"]["max_locks_per_transaction"]["minimum"]
)
self.assertFalse(
config["pg"]["max_locks_per_transaction"]["requires_restart"]
)
self.assertEqual(
"integer", config["pg"]["max_locks_per_transaction"]["type"]
)
self.assertEqual(
"PostgreSQL maximum logical replication workers (taken from the pool of max_parallel_workers)",
config["pg"]["max_logical_replication_workers"]["description"],
)
self.assertEqual(
64, config["pg"]["max_logical_replication_workers"]["maximum"]
)
self.assertEqual(
4, config["pg"]["max_logical_replication_workers"]["minimum"]
)
self.assertFalse(
config["pg"]["max_logical_replication_workers"]["requires_restart"]
)
self.assertEqual(
"integer", config["pg"]["max_logical_replication_workers"]["type"]
)
self.assertEqual(
"Sets the maximum number of workers that the system can support for parallel queries",
config["pg"]["max_parallel_workers"]["description"],
)
self.assertEqual(96, config["pg"]["max_parallel_workers"]["maximum"])
self.assertEqual(0, config["pg"]["max_parallel_workers"]["minimum"])
self.assertFalse(
config["pg"]["max_parallel_workers"]["requires_restart"]
)
self.assertEqual(
"integer", config["pg"]["max_parallel_workers"]["type"]
)
self.assertEqual(
"Sets the maximum number of workers that can be started by a single Gather or Gather Merge node",
config["pg"]["max_parallel_workers_per_gather"]["description"],
)
self.assertEqual(
96, config["pg"]["max_parallel_workers_per_gather"]["maximum"]
)
self.assertEqual(
0, config["pg"]["max_parallel_workers_per_gather"]["minimum"]
)
self.assertFalse(
config["pg"]["max_parallel_workers_per_gather"]["requires_restart"]
)
self.assertEqual(
"integer", config["pg"]["max_parallel_workers_per_gather"]["type"]
)
self.assertEqual(
"PostgreSQL maximum predicate locks per transaction",
config["pg"]["max_pred_locks_per_transaction"]["description"],
)
self.assertEqual(
5120, config["pg"]["max_pred_locks_per_transaction"]["maximum"]
)
self.assertEqual(
64, config["pg"]["max_pred_locks_per_transaction"]["minimum"]
)
self.assertFalse(
config["pg"]["max_pred_locks_per_transaction"]["requires_restart"]
)
self.assertEqual(
"integer", config["pg"]["max_pred_locks_per_transaction"]["type"]
)
self.assertEqual(
"PostgreSQL maximum replication slots",
config["pg"]["max_replication_slots"]["description"],
)
self.assertEqual(64, config["pg"]["max_replication_slots"]["maximum"])
self.assertEqual(8, config["pg"]["max_replication_slots"]["minimum"])
self.assertFalse(
config["pg"]["max_replication_slots"]["requires_restart"]
)
self.assertEqual(
"integer", config["pg"]["max_replication_slots"]["type"]
)
self.assertEqual(
"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"]["max_slot_wal_keep_size"]["description"],
)
self.assertEqual(
2147483647, config["pg"]["max_slot_wal_keep_size"]["maximum"]
)
self.assertEqual(-1, config["pg"]["max_slot_wal_keep_size"]["minimum"])
self.assertFalse(
config["pg"]["max_slot_wal_keep_size"]["requires_restart"]
)
self.assertEqual(
"integer", config["pg"]["max_slot_wal_keep_size"]["type"]
)
self.assertEqual(
"Maximum depth of the stack in bytes",
config["pg"]["max_stack_depth"]["description"],
)
self.assertEqual(6291456, config["pg"]["max_stack_depth"]["maximum"])
self.assertEqual(2097152, config["pg"]["max_stack_depth"]["minimum"])
self.assertFalse(config["pg"]["max_stack_depth"]["requires_restart"])
self.assertEqual("integer", config["pg"]["max_stack_depth"]["type"])
self.assertEqual(
"Max standby archive delay in milliseconds",
config["pg"]["max_standby_archive_delay"]["description"],
)
self.assertEqual(
43200000, config["pg"]["max_standby_archive_delay"]["maximum"]
)
self.assertEqual(
1, config["pg"]["max_standby_archive_delay"]["minimum"]
)
self.assertFalse(
config["pg"]["max_standby_archive_delay"]["requires_restart"]
)
self.assertEqual(
"integer", config["pg"]["max_standby_archive_delay"]["type"]
)
self.assertEqual(
"Max standby streaming delay in milliseconds",
config["pg"]["max_standby_streaming_delay"]["description"],
)
self.assertEqual(
43200000, config["pg"]["max_standby_streaming_delay"]["maximum"]
)
self.assertEqual(
1, config["pg"]["max_standby_streaming_delay"]["minimum"]
)
self.assertFalse(
config["pg"]["max_standby_streaming_delay"]["requires_restart"]
)
self.assertEqual(
"integer", config["pg"]["max_standby_streaming_delay"]["type"]
)
self.assertEqual(
"PostgreSQL maximum WAL senders",
config["pg"]["max_wal_senders"]["description"],
)
self.assertEqual(64, config["pg"]["max_wal_senders"]["maximum"])
self.assertEqual(20, config["pg"]["max_wal_senders"]["minimum"])
self.assertFalse(config["pg"]["max_wal_senders"]["requires_restart"])
self.assertEqual("integer", config["pg"]["max_wal_senders"]["type"])
self.assertEqual(
"Sets the maximum number of background processes that the system can support",
config["pg"]["max_worker_processes"]["description"],
)
self.assertEqual(96, config["pg"]["max_worker_processes"]["maximum"])
self.assertEqual(8, config["pg"]["max_worker_processes"]["minimum"])