MCPcopy Create free account
hub / github.com/devspace-sh/devspace / TestPatches

Function TestPatches

pkg/devspace/config/loader/profile_test.go:17–224  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15}
16
17func TestPatches(t *testing.T) {
18 testCases := map[string]*testCase{
19 "patch with path": {
20 profile: latest.ProfileConfig{
21 Name: "test",
22 Patches: []*latest.PatchConfig{
23 {
24 Operation: "add",
25 Path: "dev.ports",
26 Value: map[string]interface{}{
27 "imageName": "myImage",
28 },
29 },
30 },
31 },
32 in: map[string]interface{}{
33 "dev": map[string]interface{}{
34 "ports": []interface{}{
35 map[string]interface{}{
36 "imageName": "test",
37 },
38 },
39 },
40 },
41 expected: map[string]interface{}{
42 "dev": map[string]interface{}{
43 "ports": []interface{}{
44 map[string]interface{}{
45 "imageName": "test",
46 },
47 map[string]interface{}{
48 "imageName": "myImage",
49 },
50 },
51 },
52 },
53 },
54 "patch with extended matching": {
55 profile: latest.ProfileConfig{
56 Name: "test",
57 Patches: []*latest.PatchConfig{
58 {
59 Operation: "add",
60 Path: "dev.ports.imageName=test.containerName",
61 Value: "myContainer",
62 },
63 },
64 },
65 in: map[string]interface{}{
66 "dev": map[string]interface{}{
67 "ports": []interface{}{
68 map[string]interface{}{
69 "imageName": "test",
70 },
71 },
72 },
73 },
74 expected: map[string]interface{}{

Callers

nothing calls this directly

Calls 2

ApplyPatchesFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected