@@ -384,4 +384,172 @@ tests:
384384 - documentIndex : 0
385385 equal :
386386 path : spec.template.spec.imagePullSecrets[0].name
387- value : regcred
387+ value : regcred
388+
389+ - it : should have Recreate deployment strategy
390+ set :
391+ clickhouse :
392+ enabled : true
393+ asserts :
394+ - documentSelector : *deployment-selector
395+ equal :
396+ path : spec.strategy.type
397+ value : Recreate
398+
399+ - it : should have imagePullPolicy set to IfNotPresent
400+ set :
401+ clickhouse :
402+ enabled : true
403+ asserts :
404+ - documentSelector : *deployment-selector
405+ equal :
406+ path : spec.template.spec.containers[0].imagePullPolicy
407+ value : IfNotPresent
408+
409+ - it : should include resources when configured
410+ set :
411+ clickhouse :
412+ enabled : true
413+ resources :
414+ requests :
415+ memory : " 512Mi"
416+ cpu : " 500m"
417+ limits :
418+ memory : " 2Gi"
419+ cpu : " 2000m"
420+ asserts :
421+ - documentSelector : *deployment-selector
422+ equal :
423+ path : spec.template.spec.containers[0].resources.requests.memory
424+ value : " 512Mi"
425+ - documentSelector : *deployment-selector
426+ equal :
427+ path : spec.template.spec.containers[0].resources.requests.cpu
428+ value : " 500m"
429+ - documentSelector : *deployment-selector
430+ equal :
431+ path : spec.template.spec.containers[0].resources.limits.memory
432+ value : " 2Gi"
433+ - documentSelector : *deployment-selector
434+ equal :
435+ path : spec.template.spec.containers[0].resources.limits.cpu
436+ value : " 2000m"
437+
438+ - it : should not include resources when not configured
439+ set :
440+ clickhouse :
441+ enabled : true
442+ resources : {}
443+ asserts :
444+ - documentSelector : *deployment-selector
445+ isNull :
446+ path : spec.template.spec.containers[0].resources
447+
448+ - it : should include preStop lifecycle hook with correct commands
449+ set :
450+ clickhouse :
451+ enabled : true
452+ asserts :
453+ - documentSelector : *deployment-selector
454+ isNotNull :
455+ path : spec.template.spec.containers[0].lifecycle.preStop
456+ - documentSelector : *deployment-selector
457+ equal :
458+ path : spec.template.spec.containers[0].lifecycle.preStop.exec.command[0]
459+ value : /bin/sh
460+ - documentSelector : *deployment-selector
461+ equal :
462+ path : spec.template.spec.containers[0].lifecycle.preStop.exec.command[1]
463+ value : -c
464+ - documentSelector : *deployment-selector
465+ matchRegex :
466+ path : spec.template.spec.containers[0].lifecycle.preStop.exec.command[2]
467+ pattern : " .*SYSTEM STOP MERGES.*"
468+ - documentSelector : *deployment-selector
469+ matchRegex :
470+ path : spec.template.spec.containers[0].lifecycle.preStop.exec.command[2]
471+ pattern : " .*SYSTEM STOP MOVES.*"
472+ - documentSelector : *deployment-selector
473+ matchRegex :
474+ path : spec.template.spec.containers[0].lifecycle.preStop.exec.command[2]
475+ pattern : " .*SYSTEM FLUSH LOGS.*"
476+
477+ - it : should include startupProbe with default values when enabled
478+ set :
479+ clickhouse :
480+ enabled : true
481+ port : 8123
482+ startupProbe :
483+ enabled : true
484+ initialDelaySeconds : 5
485+ periodSeconds : 10
486+ timeoutSeconds : 5
487+ failureThreshold : 30
488+ asserts :
489+ - documentSelector : *deployment-selector
490+ isSubset :
491+ path : spec.template.spec.containers[0].startupProbe
492+ content :
493+ httpGet :
494+ path : /ping
495+ port : 8123
496+ initialDelaySeconds : 5
497+ periodSeconds : 10
498+ timeoutSeconds : 5
499+ failureThreshold : 30
500+
501+ - it : should not include startupProbe when disabled
502+ set :
503+ clickhouse :
504+ enabled : true
505+ startupProbe :
506+ enabled : false
507+ asserts :
508+ - documentSelector : *deployment-selector
509+ isNull :
510+ path : spec.template.spec.containers[0].startupProbe
511+
512+ - it : should use custom startupProbe values when provided
513+ set :
514+ clickhouse :
515+ enabled : true
516+ port : 8123
517+ startupProbe :
518+ enabled : true
519+ initialDelaySeconds : 10
520+ periodSeconds : 15
521+ timeoutSeconds : 10
522+ failureThreshold : 60
523+ asserts :
524+ - documentSelector : *deployment-selector
525+ isSubset :
526+ path : spec.template.spec.containers[0].startupProbe
527+ content :
528+ httpGet :
529+ path : /ping
530+ port : 8123
531+ initialDelaySeconds : 10
532+ periodSeconds : 15
533+ timeoutSeconds : 10
534+ failureThreshold : 60
535+
536+ - it : should have default terminationGracePeriodSeconds of 90
537+ set :
538+ clickhouse :
539+ enabled : true
540+ asserts :
541+ - documentSelector : *deployment-selector
542+ equal :
543+ path : spec.template.spec.terminationGracePeriodSeconds
544+ value : 90
545+
546+ - it : should use custom terminationGracePeriodSeconds when provided
547+ set :
548+ clickhouse :
549+ enabled : true
550+ terminationGracePeriodSeconds : 120
551+ asserts :
552+ - documentSelector : *deployment-selector
553+ equal :
554+ path : spec.template.spec.terminationGracePeriodSeconds
555+ value : 120
0 commit comments