@@ -71,6 +71,42 @@ def fuzz_format_string():
7171 )
7272
7373
74+ def fuzz_cancelation ():
75+ return random .choice (
76+ [
77+ None ,
78+ {},
79+ {"mode" : "NOTIFY_THEN_TERMINATE" },
80+ {"mode" : "TERMINATE" },
81+ {"mode" : "INVALID_MODE" },
82+ {"mode" : random_string (1 , 20 )},
83+ {"mode" : None },
84+ {"mode" : 123 },
85+ {"mode" : "NOTIFY_THEN_TERMINATE" , "notifyPeriodInSeconds" : 30 },
86+ {"mode" : "NOTIFY_THEN_TERMINATE" , "notifyPeriodInSeconds" : "invalid" },
87+ random_string (1 , 10 ),
88+ ]
89+ )
90+
91+
92+ def fuzz_task_parameter ():
93+ return random .choice (
94+ [
95+ {},
96+ {"name" : "P" , "type" : "INT" , "range" : "1-10" },
97+ {"name" : "P" , "type" : "FLOAT" , "range" : [1.0 , 2.0 ]},
98+ {"name" : "P" , "type" : "STRING" , "values" : ["a" , "b" ]},
99+ {"name" : "P" , "type" : "PATH" , "values" : ["/tmp" ]},
100+ {"name" : "P" , "type" : "INVALID_TYPE" , "range" : "1-10" },
101+ {"name" : "P" , "type" : random_string (1 , 15 ), "range" : "1-10" },
102+ {"name" : "P" , "type" : None },
103+ {"name" : "P" , "type" : 123 },
104+ {"type" : "INT" , "range" : "1-10" },
105+ random_string (1 , 10 ),
106+ ]
107+ )
108+
109+
74110def fuzz_step ():
75111 base = {"name" : "Step1" , "script" : {"actions" : {"onRun" : {"command" : "echo" }}}}
76112 mutations = [
@@ -81,8 +117,15 @@ def fuzz_step():
81117 {"name" : "Step1" , "script" : {"actions" : {}}},
82118 {"name" : "Step1" , "script" : {"actions" : {"onRun" : {}}}},
83119 {"name" : "Step1" , "script" : {"actions" : {"onRun" : {"command" : "" }}}},
120+ {
121+ "name" : "Step1" ,
122+ "script" : {
123+ "actions" : {"onRun" : {"command" : "echo" , "cancelation" : fuzz_cancelation ()}}
124+ },
125+ },
84126 {** base , "parameterSpace" : {}},
85127 {** base , "parameterSpace" : {"taskParameterDefinitions" : []}},
128+ {** base , "parameterSpace" : {"taskParameterDefinitions" : [fuzz_task_parameter ()]}},
86129 {
87130 ** base ,
88131 "parameterSpace" : {
@@ -106,12 +149,16 @@ def fuzz_job_parameter():
106149 {"name" : "Param1" , "type" : "FLOAT" },
107150 {"name" : "Param1" , "type" : "PATH" },
108151 {"name" : "Param1" , "type" : "INVALID" },
152+ {"name" : "Param1" , "type" : random_string (1 , 15 )},
153+ {"name" : "Param1" , "type" : None },
154+ {"name" : "Param1" , "type" : 123 },
109155 {"name" : "" , "type" : "STRING" },
110156 {"name" : 123 , "type" : "STRING" },
111157 {"type" : "STRING" },
112158 {"name" : "P" , "type" : "INT" , "minValue" : 10 , "maxValue" : 5 },
113159 {"name" : "P" , "type" : "INT" , "default" : "notanint" },
114160 {"name" : "P" , "type" : "STRING" , "allowedValues" : []},
161+ random_string (1 , 10 ),
115162 ]
116163 )
117164
0 commit comments