@@ -22,6 +22,7 @@ import (
2222 "os"
2323 "path/filepath"
2424 "reflect"
25+ "slices"
2526 "strings"
2627 "testing"
2728
@@ -115,18 +116,6 @@ func newServiceConfigWithServiceVolumeMount(volumeMountSubPathValue string) kobj
115116 }
116117}
117118
118- func equalStringSlice (s1 , s2 []string ) bool {
119- if len (s1 ) != len (s2 ) {
120- return false
121- }
122- for i := range s1 {
123- if s1 [i ] != s2 [i ] {
124- return false
125- }
126- }
127- return true
128- }
129-
130119func equalEnv (kobjectEnvs []kobject.EnvVar , k8sEnvs []api.EnvVar ) bool {
131120 if len (kobjectEnvs ) != len (k8sEnvs ) {
132121 return false
@@ -198,13 +187,13 @@ func checkPodTemplate(config kobject.ServiceConfig, template api.PodTemplateSpec
198187 if ! equalPorts (config .Port , container .Ports ) {
199188 return fmt .Errorf ("Found different container ports: %#v vs. %#v" , config .Port , container .Ports )
200189 }
201- if ! equalStringSlice (config .Command , container .Command ) {
190+ if ! slices . Equal (config .Command , container .Command ) {
202191 return fmt .Errorf ("Found different container cmd: %#v vs. %#v" , config .Command , container .Command )
203192 }
204193 if config .WorkingDir != container .WorkingDir {
205194 return fmt .Errorf ("Found different container WorkingDir: %#v vs. %#v" , config .WorkingDir , container .WorkingDir )
206195 }
207- if ! equalStringSlice (config .Args , container .Args ) {
196+ if ! slices . Equal (config .Args , container .Args ) {
208197 return fmt .Errorf ("Found different container args: %#v vs. %#v" , config .Args , container .Args )
209198 }
210199 if len (template .Spec .Volumes ) == 0 || len (template .Spec .Volumes [0 ].Name ) == 0 || template .Spec .Volumes [0 ].VolumeSource .PersistentVolumeClaim == nil && template .Spec .Volumes [0 ].ConfigMap == nil {
0 commit comments