@@ -65,8 +65,9 @@ func TestGetNamespaceValidations(t *testing.T) {
65
65
var changeMap = map [string ]string {}
66
66
vInfo , err := vs .NewValidationInfo (context .Background (), []string {conf .KubernetesConfig .ClusterName }, changeMap )
67
67
require .NoError (err )
68
- validations , err := vs .Validate (context .Background (), conf .KubernetesConfig .ClusterName , vInfo )
68
+ validationPerformed , validations , err := vs .Validate (context .Background (), conf .KubernetesConfig .ClusterName , vInfo )
69
69
require .NoError (err )
70
+ assert .True (validationPerformed )
70
71
vs .kialiCache .Validations ().Replace (validations )
71
72
72
73
validations , err = vs .GetValidations (context .TODO (), conf .KubernetesConfig .ClusterName )
@@ -77,17 +78,19 @@ func TestGetNamespaceValidations(t *testing.T) {
77
78
// simulate a reconcile w/o a config change should skip running the checkers (new vInfo but re-use the changemap)
78
79
vInfo , err = vs .NewValidationInfo (context .Background (), []string {conf .KubernetesConfig .ClusterName }, changeMap )
79
80
require .NoError (err )
80
- validations , err = vs .Validate (context .Background (), conf .KubernetesConfig .ClusterName , vInfo )
81
+ validationPerformed , validations , err = vs .Validate (context .Background (), conf .KubernetesConfig .ClusterName , vInfo )
81
82
require .NoError (err )
83
+ assert .False (validationPerformed )
82
84
assert .Nil (validations )
83
85
84
86
// refresh the config but keep the changeMap, and we should see new validations. (note PeerAuthentication config updates its ResourceVersion)
85
87
vs = mockCombinedValidationService (t , conf , fakeIstioConfigList (),
86
88
[]string {"details.test.svc.cluster.local" , "product.test.svc.cluster.local" , "product2.test.svc.cluster.local" , "customer.test.svc.cluster.local" })
87
89
vInfo , err = vs .NewValidationInfo (context .Background (), []string {conf .KubernetesConfig .ClusterName }, changeMap )
88
90
require .NoError (err )
89
- validations , err = vs .Validate (context .Background (), conf .KubernetesConfig .ClusterName , vInfo )
91
+ validationPerformed , validations , err = vs .Validate (context .Background (), conf .KubernetesConfig .ClusterName , vInfo )
90
92
require .NoError (err )
93
+ assert .True (validationPerformed )
91
94
assert .NotNil (validations )
92
95
}
93
96
@@ -723,8 +726,9 @@ func TestValidatingSingleObjectUpdatesList(t *testing.T) {
723
726
724
727
vInfo , err := vs .NewValidationInfo (context .Background (), []string {conf .KubernetesConfig .ClusterName }, nil )
725
728
require .NoError (err )
726
- validations , err := vs .Validate (context .Background (), conf .KubernetesConfig .ClusterName , vInfo )
729
+ validationPerformed , validations , err := vs .Validate (context .Background (), conf .KubernetesConfig .ClusterName , vInfo )
727
730
require .NoError (err )
731
+ assert .True (validationPerformed )
728
732
vs .kialiCache .Validations ().Replace (validations )
729
733
730
734
currentValidations , err := vs .GetValidations (context .Background (), conf .KubernetesConfig .ClusterName )
@@ -740,8 +744,9 @@ func TestValidatingSingleObjectUpdatesList(t *testing.T) {
740
744
// make sure validations are updated in a cache before retrieving them
741
745
vInfo , err = vs .NewValidationInfo (context .Background (), []string {conf .KubernetesConfig .ClusterName }, nil )
742
746
require .NoError (err )
743
- validations , err = vs .Validate (context .Background (), conf .KubernetesConfig .ClusterName , vInfo )
747
+ validationPerformed , validations , err = vs .Validate (context .Background (), conf .KubernetesConfig .ClusterName , vInfo )
744
748
require .NoError (err )
749
+ assert .True (validationPerformed )
745
750
vs .kialiCache .Validations ().Replace (validations )
746
751
747
752
updatedValidations , _ , err := vs .ValidateIstioObject (context .Background (), conf .KubernetesConfig .ClusterName , "test" , kubernetes .VirtualServices , "product-vs" )
0 commit comments