@@ -265,6 +265,72 @@ func TestJvmGarbageCollectorParallel(t *testing.T) {
265265 g .Expect (e .OsCmd .Args ).To (ConsistOf (expected ))
266266}
267267
268+ func TestJvmGarbageCollectorSerial (t * testing.T ) {
269+ g := NewGomegaWithT (t )
270+
271+ d := & coh.Coherence {
272+ ObjectMeta : metav1.ObjectMeta {Name : "test" },
273+ Spec : coh.CoherenceStatefulSetResourceSpec {
274+ CoherenceResourceSpec : coh.CoherenceResourceSpec {
275+ JVM : & coh.JVMSpec {
276+ Gc : & coh.JvmGarbageCollectorSpec {
277+ Collector : ptr .To ("serial" ),
278+ },
279+ },
280+ },
281+ },
282+ }
283+
284+ expectedArgs := append (GetExpectedArgsFileContentWithoutPrefix ("-XX:+UseG1GC" ), "-XX:+UseSerialGC" )
285+ verifyConfigFilesWithArgs (t , d , expectedArgs )
286+
287+ args := []string {"server" , "--dry-run" }
288+ env := EnvVarsFromDeployment (t , d )
289+
290+ e , err := ExecuteWithArgsAndNewViper (env , args )
291+ g .Expect (err ).NotTo (HaveOccurred ())
292+ g .Expect (e ).NotTo (BeNil ())
293+ g .Expect (e .OsCmd ).NotTo (BeNil ())
294+
295+ g .Expect (e .OsCmd .Dir ).To (Equal (TestAppDir ))
296+ g .Expect (e .OsCmd .Path ).To (Equal (GetJavaCommand ()))
297+ expected := append (RemoveArgWithPrefix (GetMinimalExpectedArgs (t ), "-XX:+UseG1GC" ), "-XX:+UseSerialGC" )
298+ g .Expect (e .OsCmd .Args ).To (ConsistOf (expected ))
299+ }
300+
301+ func TestJvmGarbageCollectorZGC (t * testing.T ) {
302+ g := NewGomegaWithT (t )
303+
304+ d := & coh.Coherence {
305+ ObjectMeta : metav1.ObjectMeta {Name : "test" },
306+ Spec : coh.CoherenceStatefulSetResourceSpec {
307+ CoherenceResourceSpec : coh.CoherenceResourceSpec {
308+ JVM : & coh.JVMSpec {
309+ Gc : & coh.JvmGarbageCollectorSpec {
310+ Collector : ptr .To ("zgc" ),
311+ },
312+ },
313+ },
314+ },
315+ }
316+
317+ expectedArgs := append (GetExpectedArgsFileContentWithoutPrefix ("-XX:+UseG1GC" ), "-XX:+UseZGC" )
318+ verifyConfigFilesWithArgs (t , d , expectedArgs )
319+
320+ args := []string {"server" , "--dry-run" }
321+ env := EnvVarsFromDeployment (t , d )
322+
323+ e , err := ExecuteWithArgsAndNewViper (env , args )
324+ g .Expect (err ).NotTo (HaveOccurred ())
325+ g .Expect (e ).NotTo (BeNil ())
326+ g .Expect (e .OsCmd ).NotTo (BeNil ())
327+
328+ g .Expect (e .OsCmd .Dir ).To (Equal (TestAppDir ))
329+ g .Expect (e .OsCmd .Path ).To (Equal (GetJavaCommand ()))
330+ expected := append (RemoveArgWithPrefix (GetMinimalExpectedArgs (t ), "-XX:+UseG1GC" ), "-XX:+UseZGC" )
331+ g .Expect (e .OsCmd .Args ).To (ConsistOf (expected ))
332+ }
333+
268334func TestJvmGarbageCollectorLoggingTrue (t * testing.T ) {
269335 g := NewGomegaWithT (t )
270336
0 commit comments