55
66class AgentSetupValidateTest < Minitest ::Test
77 NON_EXISTING_CONFIG_FILENAME = '123.yml'
8+ INVALID_YAML_CONFIG_FILENAME = 'spec/fixtures/config/invalid_yaml_config.yml'
89 INVALID_CONFIG_FILENAME = 'spec/fixtures/config/invalid_config.yml'
910
1011 def test_init_when_config_exists
@@ -26,15 +27,30 @@ def test_init_with_non_existing_config_file
2627 assert_equal expected , output . strip
2728 end
2829
29- def test_init_with_custom_invalid_YAML
30+ def test_init_with_invalid_YAML
31+ output = `./exe/appmap-agent-validate -c #{ INVALID_YAML_CONFIG_FILENAME } `
32+ assert_equal 0 , $CHILD_STATUS. exitstatus
33+ expected = JSON . pretty_generate ( [
34+ {
35+ level : :error ,
36+ filename : INVALID_YAML_CONFIG_FILENAME ,
37+ message : 'AppMap configuration is not valid YAML' ,
38+ detailed_message : "(#{ INVALID_YAML_CONFIG_FILENAME } ): " \
39+ 'did not find expected key while parsing a block mapping at line 1 column 1'
40+ }
41+ ] )
42+ assert_equal expected , output . strip
43+ end
44+
45+ def test_init_with_invalid_data_config
3046 output = `./exe/appmap-agent-validate -c #{ INVALID_CONFIG_FILENAME } `
3147 assert_equal 0 , $CHILD_STATUS. exitstatus
3248 expected = JSON . pretty_generate ( [
3349 {
3450 level : :error ,
3551 filename : INVALID_CONFIG_FILENAME ,
36- message : 'AppMap configuration is not valid YAML ' ,
37- detailed_message : "(<unknown>): did not find expected key while parsing a block mapping at line 1 column 1 "
52+ message : 'AppMap configuration could not be loaded. ' ,
53+ detailed_message : "undefined method `map' for \" not_array \" :String \n Did you mean? tap "
3854 }
3955 ] )
4056 assert_equal expected , output . strip
0 commit comments