Skip to content

Commit

Permalink
remove unused test objects
Browse files Browse the repository at this point in the history
Signed-off-by: Chanwit Kaewkasi <chanwit@weave.works>
  • Loading branch information
Chanwit Kaewkasi committed Aug 16, 2023
1 parent 51c1385 commit 9272e69
Showing 1 changed file with 5 additions and 34 deletions.
39 changes: 5 additions & 34 deletions core/server/inventory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,12 @@ func TestGetBlankInventoryKustomization(t *testing.T) {
ctx := context.Background()

automationName := "my-automation"

ns := corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: "test-namespace",
Labels: map[string]string{
"toolkit.fluxcd.io/tenant": "tenant",
},
},
}
ns := "test-namespace"

deployment := &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: "my-deployment",
Namespace: ns.Name,
Namespace: ns,
UID: "this-is-not-an-uid",
},
Spec: appsv1.DeploymentSpec{
Expand All @@ -170,31 +162,10 @@ func TestGetBlankInventoryKustomization(t *testing.T) {
},
}

rs := &appsv1.ReplicaSet{
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("%s-123abcd", automationName),
Namespace: ns.Name,
},
Spec: appsv1.ReplicaSetSpec{
Template: deployment.Spec.Template,
Selector: deployment.Spec.Selector,
},
Status: appsv1.ReplicaSetStatus{
Replicas: 1,
},
}

rs.SetOwnerReferences([]metav1.OwnerReference{{
UID: deployment.UID,
APIVersion: appsv1.SchemeGroupVersion.String(),
Kind: "Deployment",
Name: deployment.Name,
}})

kust := &kustomizev1.Kustomization{
ObjectMeta: metav1.ObjectMeta{
Name: automationName,
Namespace: ns.Name,
Namespace: ns,
},
Spec: kustomizev1.KustomizationSpec{
SourceRef: kustomizev1.CrossNamespaceSourceReference{
Expand All @@ -209,12 +180,12 @@ func TestGetBlankInventoryKustomization(t *testing.T) {
scheme, err := kube.CreateScheme()
g.Expect(err).To(BeNil())

client := fake.NewClientBuilder().WithScheme(scheme).WithRuntimeObjects(&ns, kust, deployment, rs).Build()
client := fake.NewClientBuilder().WithScheme(scheme).WithRuntimeObjects(kust, deployment).Build()
cfg := makeServerConfig(client, t, "")
c := makeServer(cfg, t)

res, err := c.GetInventory(ctx, &pb.GetInventoryRequest{
Namespace: ns.Name,
Namespace: ns,
ClusterName: cluster.DefaultCluster,
Kind: "Kustomization",
Name: kust.Name,
Expand Down

0 comments on commit 9272e69

Please sign in to comment.