Skip to content

Commit a8eac02

Browse files
uploadExcludePaths configuration e2e test
1 parent d6b5cc9 commit a8eac02

4 files changed

Lines changed: 110 additions & 0 deletions

File tree

e2e/tests/sync/sync.go

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,73 @@ var _ = DevSpaceDescribe("sync", func() {
551551
waitGroup.Wait()
552552
})
553553

554+
ginkgo.It("should sync to a pod container with uploadExcludePaths configuration", func() {
555+
tempDir, err := framework.CopyToTempDir("tests/sync/testdata/sync-exclude-dir")
556+
framework.ExpectNoError(err)
557+
defer framework.CleanupTempDir(initialDir, tempDir)
558+
559+
ns, err := kubeClient.CreateNamespace("sync")
560+
framework.ExpectNoError(err)
561+
defer func() {
562+
err := kubeClient.DeleteNamespace(ns)
563+
framework.ExpectNoError(err)
564+
}()
565+
566+
// deploy app to sync
567+
deployCmd := &cmd.RunPipelineCmd{
568+
GlobalFlags: &flags.GlobalFlags{
569+
NoWarn: true,
570+
Namespace: ns,
571+
ConfigPath: "devspace.yaml",
572+
},
573+
Pipeline: "deploy",
574+
}
575+
err = deployCmd.RunDefault(f)
576+
framework.ExpectNoError(err)
577+
578+
cancelCtx, stop := context.WithCancel(context.Background())
579+
defer stop()
580+
581+
// sync command
582+
syncCmd := &cmd.SyncCmd{
583+
GlobalFlags: &flags.GlobalFlags{
584+
NoWarn: true,
585+
Namespace: ns,
586+
ConfigPath: "devspace.yaml",
587+
},
588+
Wait: true,
589+
Ctx: cancelCtx,
590+
}
591+
592+
// start the command
593+
waitGroup := sync.WaitGroup{}
594+
waitGroup.Add(1)
595+
go func() {
596+
defer ginkgo.GinkgoRecover()
597+
defer waitGroup.Done()
598+
err = syncCmd.Run(f)
599+
framework.ExpectNoError(err)
600+
}()
601+
602+
// check that uploadExcludePaths folder was not synced
603+
framework.ExpectRemoteFileNotFound("alpine", ns, "/app/node_modules")
604+
605+
// check that included file was synced
606+
framework.ExpectRemoteFileContents("alpine", ns, "/app/syncme/file.txt", "I will be synced")
607+
608+
// write a file and check that it got synced
609+
payload := randutil.GenerateRandomString(10000)
610+
err = ioutil.WriteFile(filepath.Join(tempDir, "watching.txt"), []byte(payload), 0666)
611+
framework.ExpectNoError(err)
612+
framework.ExpectRemoteFileContents("alpine", ns, "/app/watching.txt", payload)
613+
614+
// stop command
615+
stop()
616+
617+
// wait for the command to finish
618+
waitGroup.Wait()
619+
})
620+
554621
ginkgo.It("should sync to a pod container with excludeFile, downloadExcludeFile, and uploadExcludeFile configuration", func() {
555622
tempDir, err := framework.CopyToTempDir("tests/sync/testdata/sync-exclude-file")
556623
framework.ExpectNoError(err)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: v2beta1
2+
vars:
3+
IMAGE: alpine
4+
deployments:
5+
test:
6+
helm:
7+
chart:
8+
name: component-chart
9+
repo: https://charts.devspace.sh
10+
values:
11+
containers:
12+
- image: ${IMAGE}
13+
command: ["sleep"]
14+
args: ["999999999999"]
15+
pipelines:
16+
deploy: |-
17+
run_dependencies --all
18+
create_deployments --all
19+
echo "dep2" >> out.txt
20+
dev:
21+
test:
22+
imageSelector: ${IMAGE}
23+
sync:
24+
- path: ./:/app
25+
uploadExcludePaths:
26+
- node_modules/

e2e/tests/sync/testdata/sync-exclude-dir/node_modules/nodemon/nodemon.js

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
I will be synced

0 commit comments

Comments
 (0)