@@ -62,10 +62,27 @@ def step_impl(context: MinifiTestContext, file_name: str, content: str, path: st
6262 context .get_or_create_default_minifi_container ().files .append (File (os .path .join (path , file_name ), new_content ))
6363
6464
65- @step ('a file with the content "{content}" is present in "{path}"' )
65+ @given ('a file with the content "{content}" is present in "{path}" in the "{container_name}" flow' )
66+ def step_impl (context : MinifiTestContext , content : str , path : str , container_name : str ):
67+ new_content = content .replace ("\\ n" , "\n " )
68+ context .get_or_create_minifi_container (container_name ).files .append (File (os .path .join (path , str (uuid .uuid4 ())), new_content ))
69+
70+
71+ @given ('a file with the content "{content}" is present in "{path}"' )
72+ @given ("a file with the content '{content}' is present in '{path}'" )
6673def step_impl (context : MinifiTestContext , content : str , path : str ):
74+ context .execute_steps (f"given a file with the content \" { content } \" is present in \" { path } \" in the \" { DEFAULT_MINIFI_CONTAINER_NAME } \" flow" )
75+
76+
77+ @when ('a file with the content "{content}" is placed in "{path}" in the "{container_name}" flow' )
78+ def step_impl (context : MinifiTestContext , content : str , path : str , container_name : str ):
6779 new_content = content .replace ("\\ n" , "\n " )
68- context .get_or_create_default_minifi_container ().files .append (File (os .path .join (path , str (uuid .uuid4 ())), new_content ))
80+ context .get_minifi_container (container_name ).add_file_to_running_container (new_content , path )
81+
82+
83+ @when ('a file with the content "{content}" is placed in "{path}"' )
84+ def step_impl (context : MinifiTestContext , content : str , path : str ):
85+ context .execute_steps (f"when a file with the content \" { content } \" is placed in \" { path } \" in the \" { DEFAULT_MINIFI_CONTAINER_NAME } \" flow" )
6986
7087
7188@given ("an empty file is present in \" {path}\" " )
@@ -95,11 +112,31 @@ def step_impl(context: MinifiTestContext):
95112 context .get_or_create_default_minifi_container ().stop ()
96113
97114
115+ @when ("\" {container_name}\" flow is stopped" )
116+ def step_impl (context : MinifiTestContext , container_name : str ):
117+ context .get_or_create_minifi_container (container_name ).stop ()
118+
119+
98120@when ("MiNiFi is restarted" )
99121def step_impl (context : MinifiTestContext ):
100122 context .get_or_create_default_minifi_container ().restart ()
101123
102124
125+ @when ("\" {container_name}\" flow is restarted" )
126+ def step_impl (context : MinifiTestContext , container_name : str ):
127+ context .get_or_create_minifi_container (container_name ).restart ()
128+
129+
130+ @when ("\" {container_name}\" flow is started" )
131+ def step_impl (context : MinifiTestContext , container_name : str ):
132+ context .get_or_create_minifi_container (container_name ).start ()
133+
134+
135+ @when ("\" {container_name}\" flow is killed" )
136+ def step_impl (context : MinifiTestContext , container_name : str ):
137+ context .get_or_create_minifi_container (container_name ).kill ()
138+
139+
103140@given ("OpenSSL FIPS mode is enabled in MiNiFi" )
104141def step_impl (context : MinifiTestContext ):
105142 context .get_or_create_default_minifi_container ().enable_openssl_fips_mode ()
@@ -145,3 +182,8 @@ def step_impl(context: MinifiTestContext):
145182def step_impl (context : MinifiTestContext ):
146183 context .containers ["minifi-c2-server" ] = MinifiC2Server (context )
147184 assert context .containers ["minifi-c2-server" ].deploy ()
185+
186+
187+ @step ("{duration} later" )
188+ def step_impl (context : MinifiTestContext , duration : str ):
189+ time .sleep (humanfriendly .parse_timespan (duration ))
0 commit comments