Skip to content

Commit

Permalink
DEBUG E2E tests
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Pantelis <[email protected]>
  • Loading branch information
tpantelis committed Jul 25, 2023
1 parent 64c6b84 commit ae12431
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
13 changes: 12 additions & 1 deletion pkg/agent/controller/endpoint_slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

"github.com/pkg/errors"
"github.com/submariner-io/admiral/pkg/log"
"github.com/submariner-io/admiral/pkg/resource"
"github.com/submariner-io/admiral/pkg/slices"
"github.com/submariner-io/admiral/pkg/syncer"
"github.com/submariner-io/admiral/pkg/syncer/broker"
Expand Down Expand Up @@ -100,6 +101,11 @@ func (c *EndpointSliceController) start(stopCh <-chan struct{}) error {
func (c *EndpointSliceController) onLocalEndpointSlice(obj runtime.Object, _ int, op syncer.Operation) (runtime.Object, bool) {
endpointSlice := obj.(*discovery.EndpointSlice)

logger.V(log.DEBUG).Infof("Local EndpointSlice %q for service \"%s/%s\" %sd locally",
endpointSlice.Name, endpointSlice.Labels[constants.LabelSourceNamespace],
endpointSlice.Labels[mcsv1a1.LabelServiceName], op)
logger.Infof("***hasNoRemainingEndpointSlices: %v", c.hasNoRemainingEndpointSlices(endpointSlice))

if op != syncer.Delete && isLegacyEndpointSlice(endpointSlice) {
logger.Infof("Found legacy EndpointSlice %s/%s - deleting it",
endpointSlice.Namespace, endpointSlice.Name)
Expand Down Expand Up @@ -144,7 +150,8 @@ func (c *EndpointSliceController) onLocalEndpointSliceSynced(obj runtime.Object,
serviceName := endpointSlice.Labels[mcsv1a1.LabelServiceName]
serviceNamespace := endpointSlice.Labels[constants.LabelSourceNamespace]

logger.V(log.DEBUG).Infof("Local EndpointSlice for service \"%s/%s\" %sd on broker", serviceNamespace, serviceName, op)
logger.V(log.DEBUG).Infof("Local EndpointSlice %q for service \"%s/%s\" %sd on broker",
endpointSlice.Name, serviceNamespace, serviceName, op)

var err error

Expand Down Expand Up @@ -180,9 +187,13 @@ func (c *EndpointSliceController) hasNoRemainingEndpointSlices(endpointSlice *di
constants.MCSLabelSourceCluster: endpointSlice.Labels[constants.MCSLabelSourceCluster],
}))

logger.Infof("***hasNoRemainingEndpointSlices - is headless: %s", resource.ToJSON(list))

return len(list) == 0
}

logger.Info("***hasNoRemainingEndpointSlices - not headless")

return true
}

Expand Down
7 changes: 7 additions & 0 deletions pkg/agent/controller/service_import_aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,23 @@ func (a *ServiceImportAggregator) update(name, namespace string, mutate func(*mc
},
}

_, err := resource.ForDynamic(a.brokerServiceImportClient()).Get(context.TODO(), aggregate.GetName(), metav1.GetOptions{})
logger.Infof("***In ServiceImportAggregator.update: %s/%s, get err: %v", namespace, name, err)

//nolint:wrapcheck // No need to wrap the return error.
return util.Update(context.Background(), resource.ForDynamic(a.brokerServiceImportClient()), a.converter.toUnstructured(aggregate),
func(obj runtime.Object) (runtime.Object, error) {
existing := a.converter.toServiceImport(obj)

logger.Infof("***Found existing: %s", resource.ToJSON(existing))

err := mutate(existing)
if err != nil {
return nil, err
}

logger.Infof("***After mutate: %s", resource.ToJSON(existing))

if len(existing.Status.Clusters) == 0 {
logger.V(log.DEBUG).Infof("Deleting aggregated ServiceImport %q", existing.Name)

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/discovery/headless_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const (
opAre = "are"
)

var _ = Describe("[discovery] Test Headless Service Discovery Across Clusters", func() {
var _ = PDescribe("[discovery] Test Headless Service Discovery Across Clusters", func() {
f := lhframework.NewFramework("discovery")

When("a pod tries to resolve a headless service in a remote cluster", func() {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/discovery/service_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const (

var checkedDomains = lhframework.CheckedDomains

var _ = Describe("[discovery] Test Service Discovery Across Clusters", func() {
var _ = PDescribe("[discovery] Test Service Discovery Across Clusters", func() {
f := lhframework.NewFramework("discovery")

When("a pod tries to resolve a service in a remote cluster", func() {
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/discovery/statefulsets.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
var _ = Describe("[discovery] Test Stateful Sets Discovery Across Clusters", func() {
f := lhframework.NewFramework("discovery")

When("a pod tries to resolve a podname from stateful set in a remote cluster", func() {
PWhen("a pod tries to resolve a podname from stateful set in a remote cluster", func() {
It("should resolve the pod IP from the remote cluster", func() {
RunSSDiscoveryTest(f)
})
Expand All @@ -45,7 +45,7 @@ var _ = Describe("[discovery] Test Stateful Sets Discovery Across Clusters", fun
})
})

When("the number of active pods backing a stateful set changes", func() {
PWhen("the number of active pods backing a stateful set changes", func() {
It("should only resolve the IPs from the active pods", func() {
RunSSPodsAvailabilityTest(f)
})
Expand Down

0 comments on commit ae12431

Please sign in to comment.