File tree 3 files changed +67
-3
lines changed
main/kotlin/org/evomaster/core
kotlin/org/evomaster/core/config
3 files changed +67
-3
lines changed Original file line number Diff line number Diff line change @@ -355,9 +355,16 @@ class EMConfig {
355
355
LoggingUtil .uniqueUserInfo(" Loading configuration file from: ${Path (configPath).toAbsolutePath()} " )
356
356
}
357
357
358
- val cf = ConfigUtil .readFromFile(configPath)
359
- cf.validateAndNormalizeAuth()
360
- return cf
358
+ try {
359
+ val cf = ConfigUtil .readFromFile(configPath)
360
+ cf.validateAndNormalizeAuth()
361
+ return cf
362
+ }catch (e: Exception ){
363
+ val cause = if (e.cause!= null ) " \n Cause:${e.cause!! .message} " else " "
364
+ throw ConfigProblemException (" Failed when reading configuration file at $configPath ." +
365
+ " \n Error: ${e.message} " +
366
+ " $cause " )
367
+ }
361
368
}
362
369
363
370
private fun applyConfigFromFile (cff : ConfigsFromFile ) {
Original file line number Diff line number Diff line change @@ -80,4 +80,14 @@ class ConfigUtilTest{
80
80
assertTrue(config.auth.any { it.loginEndpointAuth.payloadUserPwd == null && it.loginEndpointAuth.payloadRaw != null })
81
81
assertTrue(config.auth.any { it.loginEndpointAuth.payloadUserPwd != null && it.loginEndpointAuth.payloadRaw == null })
82
82
}
83
+
84
+
85
+ @Test
86
+ fun testIssue1159 (){
87
+
88
+ val path = " ${basePath} /issue1159.yaml"
89
+ org.junit.jupiter.api.assertThrows<IllegalArgumentException > {
90
+ val config = ConfigUtil .readFromFile(path)
91
+ }
92
+ }
83
93
}
Original file line number Diff line number Diff line change
1
+ # https://github.com/WebFuzzing/EvoMaster/issues/1159
2
+
3
+ configs : # remove this {} when specifying properties
4
+ bbSwaggerUrl : " http://obedocumentation.fwh.is/?i=1"
5
+ bbTargetUrl : " http://obedocumentation.fwh.is/?i=1"
6
+ blackBox : true
7
+ configPath : " em.yaml"
8
+ endpointFocus : null
9
+ endpointPrefix : null
10
+ endpointTagFilter : null
11
+ # header0: ""
12
+ # header1: ""
13
+ # header2: ""
14
+ maxTime : " 60s"
15
+ outputFilePrefix : " EvoMaster"
16
+ outputFileSuffix : " Test"
17
+ outputFolder : " generated_tests"
18
+ outputFormat : " DEFAULT"
19
+ prematureStop : " "
20
+ ratePerMinute : 0
21
+ sutControllerHost : " localhost"
22
+ sutControllerPort : 40100
23
+ testTimeout : 60
24
+
25
+
26
+ auth :
27
+ - name : i gede
28
+ loginEndpointAuth :
29
+ payloadRaw :
" {\" email\" : \" [email protected] \" , \" password\" : \" sainsdata\" }"
30
+ - name : susrama
31
+ loginEndpointAuth :
32
+ payloadUserPwd :
33
+
34
+ password : " sainsdata"
35
+ usernameField : email
36
+ passwordField : password
37
+ token :
38
+ headerPrefix : " Bearer "
39
+ extractFromField : " /token/authToken"
40
+ httpHeaderName : " Authorization"
41
+
42
+ authTemplate :
43
+ loginEndpointAuth :
44
+ endpoint : /login
45
+ verb : POST
46
+ contentType : application/json
47
+ expectCookies : true
You can’t perform that action at this time.
0 commit comments