@@ -688,3 +688,81 @@ g.test_security_options = function()
688
688
t .assert_equals (box .cfg .password_history_length , 3 )
689
689
end )
690
690
end
691
+
692
+ g .test_metrics_options_default = function ()
693
+ local dir = treegen .prepare_directory (g , {}, {})
694
+ local config = [[
695
+ credentials:
696
+ users:
697
+ guest:
698
+ roles:
699
+ - super
700
+
701
+ iproto:
702
+ listen: unix/:./{{ instance_name }}.iproto
703
+
704
+ groups:
705
+ group-001:
706
+ replicasets:
707
+ replicaset-001:
708
+ instances:
709
+ instance-001: {}
710
+ ]]
711
+
712
+ -- Test defaults.
713
+ local config_file = treegen .write_script (dir , ' base_config.yaml' , config )
714
+ local opts = {
715
+ config_file = config_file ,
716
+ alias = ' instance-001' ,
717
+ chdir = dir ,
718
+ }
719
+ g .server = server :new (opts )
720
+ g .server :start ()
721
+ g .server :exec (function ()
722
+ t .assert_equals (box .cfg .metrics .include , {' all' })
723
+ t .assert_equals (box .cfg .metrics .exclude , { })
724
+ t .assert_equals (box .cfg .metrics .labels , {alias = ' instance-001' })
725
+ end )
726
+ g .server :stop ()
727
+ end
728
+
729
+ g .test_metrics_options = function ()
730
+ local dir = treegen .prepare_directory (g , {}, {})
731
+ local config = [[
732
+ credentials:
733
+ users:
734
+ guest:
735
+ roles:
736
+ - super
737
+
738
+ iproto:
739
+ listen: unix/:./{{ instance_name }}.iproto
740
+
741
+ metrics:
742
+ include: [cpu]
743
+ exclude: [all]
744
+ labels:
745
+ foo: bar
746
+
747
+ groups:
748
+ group-001:
749
+ replicasets:
750
+ replicaset-001:
751
+ instances:
752
+ instance-001: {}
753
+ ]]
754
+
755
+ local config_file = treegen .write_script (dir , ' base_config.yaml' , config )
756
+ local opts = {
757
+ config_file = config_file ,
758
+ alias = ' instance-001' ,
759
+ chdir = dir ,
760
+ }
761
+ g .server = server :new (opts )
762
+ g .server :start ()
763
+ g .server :exec (function ()
764
+ t .assert_equals (box .cfg .metrics .include , {' cpu' })
765
+ t .assert_equals (box .cfg .metrics .exclude , {' all' })
766
+ t .assert_equals (box .cfg .metrics .labels , {foo = ' bar' })
767
+ end )
768
+ end
0 commit comments