Skip to content

Commit

Permalink
Fix spelling in test/e2e/cache/cache_server_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
fgiloux committed Dec 6, 2022
1 parent c1dd09a commit b55f98b
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions test/e2e/cache/cache_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ func testSchemaIsNotEnforced(ctx context.Context, t *testing.T, cacheClientRT *r
Size int `json:"size,omitempty"`
}
earth := planet{ObjectMeta: metav1.ObjectMeta{Annotations: map[string]string{}}, Star: "TheSun", Size: 40000}
validateFn := func(earth planet, cachedPlatenRaw *unstructured.Unstructured) {
cachedEarthJson, err := cachedPlatenRaw.MarshalJSON()
validateFn := func(earth planet, cachedPlanetRaw *unstructured.Unstructured) {
cachedEarthJson, err := cachedPlanetRaw.MarshalJSON()
require.NoError(t, err)
cachedEarth := &planet{}
require.NoError(t, json.Unmarshal(cachedEarthJson, cachedEarth))
Expand All @@ -70,7 +70,7 @@ func testSchemaIsNotEnforced(ctx context.Context, t *testing.T, cacheClientRT *r
}
}

t.Logf("Create abmer|%s/earth (shard|cluster/name) on the cache server without type information", cluster)
t.Logf("Create amber|%s/earth (shard|cluster/name) on the cache server without type information", cluster)
earthRaw, err := toUnstructured(&earth)
require.NoError(t, err)
_, err = cacheDynamicClient.Cluster(cluster).Resource(gvr).Create(cacheclient.WithShardInContext(cacheclient.WithShardInContext(ctx, shard.New("amber")), shard.New("amber")), earthRaw, metav1.CreateOptions{})
Expand All @@ -80,7 +80,7 @@ func testSchemaIsNotEnforced(ctx context.Context, t *testing.T, cacheClientRT *r

earth.APIVersion = "apis.kcp.dev/v1alpha1"
earth.Kind = "APIExport"
t.Logf("Create abmer/%s/earth on the cache server without providing a name", cluster)
t.Logf("Create amber/%s/earth on the cache server without providing a name", cluster)
earthRaw, err = toUnstructured(&earth)
require.NoError(t, err)
_, err = cacheDynamicClient.Cluster(cluster).Resource(gvr).Create(cacheclient.WithShardInContext(cacheclient.WithShardInContext(ctx, shard.New("amber")), shard.New("amber")), earthRaw, metav1.CreateOptions{})
Expand All @@ -89,15 +89,15 @@ func testSchemaIsNotEnforced(ctx context.Context, t *testing.T, cacheClientRT *r
}

earth.Name = "earth"
t.Logf("Create abmer|%s/%s (shard|cluster/name) on the cache server", cluster, earth.Name)
t.Logf("Create amber|%s/%s (shard|cluster/name) on the cache server", cluster, earth.Name)
earthRaw, err = toUnstructured(&earth)
require.NoError(t, err)
cachedEarthRaw, err := cacheDynamicClient.Cluster(cluster).Resource(gvr).Create(cacheclient.WithShardInContext(cacheclient.WithShardInContext(ctx, shard.New("amber")), shard.New("amber")), earthRaw, metav1.CreateOptions{})
require.NoError(t, err)
validateFn(earth, cachedEarthRaw)

// do additional sanity check with GET
t.Logf("Get abmer|%s/%s (shard|cluster/name) from the cache server", cluster, earth.Name)
t.Logf("Get amber|%s/%s (shard|cluster/name) from the cache server", cluster, earth.Name)
cachedEarthRaw, err = cacheDynamicClient.Cluster(cluster).Resource(gvr).Get(cacheclient.WithShardInContext(cacheclient.WithShardInContext(ctx, shard.New("amber")), shard.New("amber")), earth.Name, metav1.GetOptions{})
require.NoError(t, err)
validateFn(earth, cachedEarthRaw)
Expand All @@ -122,15 +122,15 @@ func testShardClusterNamesAssigned(ctx context.Context, t *testing.T, cacheClien
}
}

t.Logf("Create abmer|%s/%s (shard|cluster/name) on the cache server", cluster, initialComicDB.Name)
t.Logf("Create amber|%s/%s (shard|cluster/name) on the cache server", cluster, initialComicDB.Name)
comicDBRaw, err := toUnstructured(&initialComicDB)
require.NoError(t, err)
cachedComicDBRaw, err := cacheDynamicClient.Cluster(cluster).Resource(gvr).Create(cacheclient.WithShardInContext(ctx, shard.New("amber")), comicDBRaw, metav1.CreateOptions{})
require.NoError(t, err)
validateFn(cachedComicDBRaw)

// do additional sanity check with GET
t.Logf("Get abmer|%s/%s (shard|cluster/name) from the cache server", cluster, initialComicDB.Name)
t.Logf("Get amber|%s/%s (shard|cluster/name) from the cache server", cluster, initialComicDB.Name)
cachedComicDBRaw, err = cacheDynamicClient.Cluster(cluster).Resource(gvr).Get(cacheclient.WithShardInContext(ctx, shard.New("amber")), initialComicDB.Name, metav1.GetOptions{})
require.NoError(t, err)
validateFn(cachedComicDBRaw)
Expand Down Expand Up @@ -159,15 +159,15 @@ func testUIDGenerationCreationTime(ctx context.Context, t *testing.T, cacheClien
}
}

t.Logf("Create abmer|%s/%s (shard|cluster/name) on the cache server", cluster, initialMangoDB.Name)
t.Logf("Create amber|%s/%s (shard|cluster/name) on the cache server", cluster, initialMangoDB.Name)
mangoDBRaw, err := toUnstructured(&initialMangoDB)
require.NoError(t, err)
cachedMangoDBRaw, err := cacheDynamicClient.Cluster(cluster).Resource(gvr).Create(cacheclient.WithShardInContext(ctx, shard.New("amber")), mangoDBRaw, metav1.CreateOptions{})
require.NoError(t, err)
validateFn(initialMangoDB, cachedMangoDBRaw)

// do additional sanity check with GET
t.Logf("Get abmer|%s/%s (shard|cluster/name) from the cache server", cluster, initialMangoDB.Name)
t.Logf("Get amber|%s/%s (shard|cluster/name) from the cache server", cluster, initialMangoDB.Name)
cachedMangoDBRaw, err = cacheDynamicClient.Cluster(cluster).Resource(gvr).Get(cacheclient.WithShardInContext(ctx, shard.New("amber")), initialMangoDB.Name, metav1.GetOptions{})
require.NoError(t, err)
validateFn(initialMangoDB, cachedMangoDBRaw)
Expand All @@ -190,13 +190,13 @@ func testUIDGenerationCreationTimeNegative(ctx context.Context, t *testing.T, ca
require.NoError(t, json.Unmarshal(cachedMangoDBJson, cachedMangoDB))

if cachedMangoDB.UID == mangoDB.UID {
t.Fatalf("unexpected UID %v set on amber|%s/%s (shard|cluster/name), an UID should be assinged by the server", cachedMangoDB.UID, cluster, mangoDB.Name)
t.Fatalf("unexpected UID %v set on amber|%s/%s (shard|cluster/name), an UID should be assigned by the server", cachedMangoDB.UID, cluster, mangoDB.Name)
}
if cachedMangoDB.Generation == mangoDB.Generation {
t.Fatalf("unexpected Generation %v set on amber|%s/%s (shard|cluster/name), a Generation should be assinged by the server", cachedMangoDB.Generation, cluster, mangoDB.Name)
t.Fatalf("unexpected Generation %v set on amber|%s/%s (shard|cluster/name), a Generation should be assigned by the server", cachedMangoDB.Generation, cluster, mangoDB.Name)
}
if cachedMangoDB.CreationTimestamp == mangoDB.CreationTimestamp {
t.Fatalf("unexpected CreationTimestamp %v set on amber|%s/%s (shard|cluster/name), a CreationTimestamp should be assinged by the server", cachedMangoDB.CreationTimestamp, cluster, mangoDB.Name)
t.Fatalf("unexpected CreationTimestamp %v set on amber|%s/%s (shard|cluster/name), a CreationTimestamp should be assigned by the server", cachedMangoDB.CreationTimestamp, cluster, mangoDB.Name)
}

mangoDB.UID = cachedMangoDB.UID
Expand All @@ -211,13 +211,13 @@ func testUIDGenerationCreationTimeNegative(ctx context.Context, t *testing.T, ca
}
}

t.Logf("Create abmer|%s/%s (shard|cluster/name) on the cache server", cluster, initialMangoDB.Name)
t.Logf("Create amber|%s/%s (shard|cluster/name) on the cache server", cluster, initialMangoDB.Name)
cachedMangoDBRaw, err := cacheDynamicClient.Cluster(cluster).Resource(gvr).Create(cacheclient.WithShardInContext(ctx, shard.New("amber")), mangoDBRaw, metav1.CreateOptions{})
require.NoError(t, err)
validateFn(initialMangoDB, cachedMangoDBRaw)

// do additional sanity check with GET
t.Logf("Get abmer|%s/%s (shard|cluster/name) from the cache server", cluster, initialMangoDB.Name)
t.Logf("Get amber|%s/%s (shard|cluster/name) from the cache server", cluster, initialMangoDB.Name)
cachedMangoDBRaw, err = cacheDynamicClient.Cluster(cluster).Resource(gvr).Get(cacheclient.WithShardInContext(ctx, shard.New("amber")), initialMangoDB.Name, metav1.GetOptions{})
require.NoError(t, err)
validateFn(initialMangoDB, cachedMangoDBRaw)
Expand All @@ -229,7 +229,7 @@ func testGenerationOnSpecChanges(ctx context.Context, t *testing.T, cacheClientR
require.NoError(t, err)
initialCinnamonDB := newFakeAPIExport("cinnamondb")

t.Logf("Create abmer|%s/%s (shard|cluster/name) on the cache server", cluster, initialCinnamonDB.Name)
t.Logf("Create amber|%s/%s (shard|cluster/name) on the cache server", cluster, initialCinnamonDB.Name)
cinnamonDBRaw, err := toUnstructured(&initialCinnamonDB)
require.NoError(t, err)
cachedCinnamonDBRaw, err := cacheDynamicClient.Cluster(cluster).Resource(gvr).Create(cacheclient.WithShardInContext(ctx, shard.New("amber")), cinnamonDBRaw, metav1.CreateOptions{})
Expand All @@ -255,7 +255,7 @@ func testGenerationOnSpecChanges(ctx context.Context, t *testing.T, cacheClientR
}

// do additional sanity check with GET
t.Logf("Get abmer|%s/%s (shard|cluster/name) from the cache server", cluster, initialCinnamonDB.Name)
t.Logf("Get amber|%s/%s (shard|cluster/name) from the cache server", cluster, initialCinnamonDB.Name)
cachedCinnamonDBRaw, err = cacheDynamicClient.Cluster(cluster).Resource(gvr).Get(cacheclient.WithShardInContext(ctx, shard.New("amber")), initialCinnamonDB.Name, metav1.GetOptions{})
require.NoError(t, err)
cachedCinnamonDBJson, err = cachedCinnamonDBRaw.MarshalJSON()
Expand All @@ -274,7 +274,7 @@ func testDeletionWithFinalizers(ctx context.Context, t *testing.T, cacheClientRT
initialGhostDB := newFakeAPIExport("ghostdb")
initialGhostDB.Finalizers = append(initialGhostDB.Finalizers, "doNotRemove")

t.Logf("Create abmer|%s/%s (shard|cluster/name) on the cache server", cluster, initialGhostDB.Name)
t.Logf("Create amber|%s/%s (shard|cluster/name) on the cache server", cluster, initialGhostDB.Name)
ghostDBRaw, err := toUnstructured(&initialGhostDB)
require.NoError(t, err)
_, err = cacheDynamicClient.Cluster(cluster).Resource(gvr).Create(cacheclient.WithShardInContext(ctx, shard.New("amber")), ghostDBRaw, metav1.CreateOptions{})
Expand All @@ -284,7 +284,7 @@ func testDeletionWithFinalizers(ctx context.Context, t *testing.T, cacheClientRT
err = cacheDynamicClient.Cluster(cluster).Resource(gvr).Delete(cacheclient.WithShardInContext(ctx, shard.New("amber")), initialGhostDB.Name, metav1.DeleteOptions{})
require.NoError(t, err)

t.Logf("Get abmer/%s/%s from the cache server", cluster, initialGhostDB.Name)
t.Logf("Get amber/%s/%s from the cache server", cluster, initialGhostDB.Name)
_, err = cacheDynamicClient.Cluster(cluster).Resource(gvr).Get(cacheclient.WithShardInContext(ctx, shard.New("amber")), initialGhostDB.Name, metav1.GetOptions{})
if !apierrors.IsNotFound(err) {
t.Fatalf("expected to get a NotFound error, got %v", err)
Expand All @@ -297,7 +297,7 @@ func testSpecStatusSimultaneously(ctx context.Context, t *testing.T, cacheClient
require.NoError(t, err)
initialCucumberDB := newFakeAPIExport("cucumberdb")

t.Logf("Create abmer|%s/%s (shard|cluster/name) on the cache server", cluster, initialCucumberDB.Name)
t.Logf("Create amber|%s/%s (shard|cluster/name) on the cache server", cluster, initialCucumberDB.Name)
cucumberDBRaw, err := toUnstructured(&initialCucumberDB)
require.NoError(t, err)
cachedCucumberDBRaw, err := cacheDynamicClient.Cluster(cluster).Resource(gvr).Create(cacheclient.WithShardInContext(ctx, shard.New("amber")), cucumberDBRaw, metav1.CreateOptions{})
Expand Down

0 comments on commit b55f98b

Please sign in to comment.