2019-07-12 16:30:02 +00:00
|
|
|
package e2e
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
|
2020-05-29 01:42:01 +00:00
|
|
|
. "github.com/argoproj/gitops-engine/pkg/sync/common"
|
2020-05-15 21:39:29 +00:00
|
|
|
|
2021-04-01 18:44:18 +00:00
|
|
|
. "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
|
|
|
|
|
. "github.com/argoproj/argo-cd/v2/test/e2e/fixture/app"
|
|
|
|
|
"github.com/argoproj/argo-cd/v2/test/fixture/test"
|
2019-07-12 16:30:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestPatch(t *testing.T) {
|
|
|
|
|
test.LocalOnly(t)
|
|
|
|
|
Given(t).
|
|
|
|
|
Path("two-nice-pods").
|
|
|
|
|
When().
|
|
|
|
|
AddFile("pod-3.yaml", `apiVersion: v1
|
|
|
|
|
kind: Pod
|
|
|
|
|
metadata:
|
|
|
|
|
name: pod-3
|
|
|
|
|
spec:
|
|
|
|
|
containers:
|
|
|
|
|
- name: main
|
2019-10-11 18:48:57 +00:00
|
|
|
image: alpine:3.10.2
|
2019-07-12 16:30:02 +00:00
|
|
|
imagePullPolicy: IfNotPresent
|
|
|
|
|
command:
|
|
|
|
|
- "true"
|
|
|
|
|
restartPolicy: Never
|
|
|
|
|
`).
|
|
|
|
|
Create().
|
|
|
|
|
Sync().
|
|
|
|
|
Then().
|
|
|
|
|
Expect(OperationPhaseIs(OperationSucceeded)).
|
|
|
|
|
Expect(SyncStatusIs(SyncStatusCodeSynced)).
|
|
|
|
|
When().
|
|
|
|
|
DeleteFile("pod-1.yaml").
|
|
|
|
|
PatchFile("pod-2.yaml", `[{"op": "add", "path": "/metadata/annotations", "value": {"bar": "Baz"}}]`).
|
|
|
|
|
AddFile("pod-4.yaml", `apiVersion: v1
|
|
|
|
|
kind: Pod
|
|
|
|
|
metadata:
|
|
|
|
|
name: pod-4
|
|
|
|
|
spec:
|
|
|
|
|
containers:
|
|
|
|
|
- name: main
|
2019-10-11 18:48:57 +00:00
|
|
|
image: alpine:3.10.2
|
2019-07-12 16:30:02 +00:00
|
|
|
imagePullPolicy: IfNotPresent
|
|
|
|
|
command:
|
|
|
|
|
- "true"
|
|
|
|
|
restartPolicy: Never
|
|
|
|
|
`).
|
|
|
|
|
Refresh(RefreshTypeHard).
|
|
|
|
|
Then().
|
|
|
|
|
Expect(SyncStatusIs(SyncStatusCodeOutOfSync))
|
|
|
|
|
}
|