Skip to content

Commit

Permalink
Unit tests fixes for prefixed SE and migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Punakshi committed Sep 3, 2024
1 parent c97d693 commit 0421531
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
6 changes: 3 additions & 3 deletions admiral/pkg/clusters/configwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func getServiceEntryEndpoints(
for resourceType, _ := range identityConfigEnvironment.Type {
// Rollout without weights is treated the same as deployment so sort and take first service
// If any of the rolloutServicesMap have weights then add them to the list of endpointsMap
if resourceType == common.Rollout {
if resourceType == common.Rollout && len(rolloutServicesMap) > 0 {
ep := tmpEp.DeepCopy()
if clientCluster == serverCluster {
if identityConfigEnvironment.Type[resourceType].Strategy == canaryStrategy {
Expand Down Expand Up @@ -219,15 +219,15 @@ func getServiceEntryEndpoints(
if !endpointFromRollout || resourceType == common.Deployment {
tmpEpCopy := tmpEp.DeepCopy()
if clientCluster == serverCluster {
if resourceType == common.Rollout {
if resourceType == common.Rollout && len(rolloutServicesMap) > 0 {
if _, ok := rolloutServicesMap[rootServiceKey]; ok {
tmpEpCopy.Address = rolloutServicesMap[rootServiceKey].Name + common.Sep + identityConfigEnvironment.Namespace + common.GetLocalDomainSuffix()
} else {
tmpEpCopy.Address = rolloutServices[0].Name + common.Sep + identityConfigEnvironment.Namespace + common.GetLocalDomainSuffix()
}
tmpEpCopy.Ports = rolloutServices[0].Ports
}
if resourceType == common.Deployment {
if resourceType == common.Deployment && len(deploymentServicesMap) > 0 {
tmpEpCopy.Address = deploymentServices[0].Name + common.Sep + identityConfigEnvironment.Namespace + common.GetLocalDomainSuffix()
tmpEpCopy.Ports = deploymentServices[0].Ports
}
Expand Down
15 changes: 12 additions & 3 deletions admiral/pkg/registry/testdata/sampleIdentityConfiguration.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
"namespace": "ns-1-usw2-prf",
"serviceName": "app-1-spk-root-service",
"services": {
"app-1-spk-root-service": {
"root": {
"name": "app-1-spk-root-service",
"weight": -1,
"ports": {
"http": 8090
},
"selectors": {
"app": "app1"
}
}
},
Expand Down Expand Up @@ -114,11 +117,14 @@
"namespace": "ns-1-usw2-e2e",
"serviceName": "app-1-spk-root-service",
"services": {
"app-1-spk-root-service": {
"root": {
"name": "app-1-spk-root-service",
"weight": -1,
"ports": {
"http": 8090
},
"selectors": {
"app": "app1"
}
}
},
Expand Down Expand Up @@ -213,11 +219,14 @@
"namespace": "ns-1-usw2-qal",
"serviceName": "app-1-spk-root-service",
"services": {
"app-1-spk-root-service": {
"root": {
"name": "app-1-spk-root-service",
"weight": -1,
"ports": {
"http": 8090
},
"selectors": {
"app": "app1"
}
}
},
Expand Down

0 comments on commit 0421531

Please sign in to comment.