|
1 | 1 | package deploy |
2 | 2 |
|
3 | 3 | import ( |
| 4 | + "bytes" |
4 | 5 | "context" |
5 | 6 | "os" |
6 | 7 | "path/filepath" |
7 | 8 | "strings" |
8 | 9 |
|
| 10 | + "github.com/loft-sh/devspace/pkg/util/log" |
| 11 | + "github.com/onsi/gomega" |
| 12 | + "github.com/sirupsen/logrus" |
| 13 | + |
9 | 14 | "github.com/onsi/ginkgo/v2" |
10 | 15 |
|
11 | 16 | "github.com/loft-sh/devspace/cmd" |
@@ -679,4 +684,72 @@ var _ = DevSpaceDescribe("deploy", func() { |
679 | 684 | framework.ExpectEqual(out2, "test") |
680 | 685 | framework.ExpectEqual(out3, "test") |
681 | 686 | }) |
| 687 | + |
| 688 | + ginkgo.It("should run helm dependency update on dependency's local chart name", func() { |
| 689 | + tempDir, err := framework.CopyToTempDir("tests/deploy/testdata/helm_git_dependency_with_local_chart") |
| 690 | + framework.ExpectNoError(err) |
| 691 | + defer framework.CleanupTempDir(initialDir, tempDir) |
| 692 | + |
| 693 | + ns, err := kubeClient.CreateNamespace("deploy") |
| 694 | + framework.ExpectNoError(err) |
| 695 | + defer func() { |
| 696 | + err := kubeClient.DeleteNamespace(ns) |
| 697 | + framework.ExpectNoError(err) |
| 698 | + }() |
| 699 | + |
| 700 | + // create a new dev command |
| 701 | + output := &bytes.Buffer{} |
| 702 | + deployCmd := &cmd.RunPipelineCmd{ |
| 703 | + GlobalFlags: &flags.GlobalFlags{ |
| 704 | + NoWarn: true, |
| 705 | + Namespace: ns, |
| 706 | + ConfigPath: "devspace-name.yaml", |
| 707 | + }, |
| 708 | + Pipeline: "deploy", |
| 709 | + Log: log.NewStreamLogger(output, output, logrus.DebugLevel), |
| 710 | + } |
| 711 | + |
| 712 | + // run the command |
| 713 | + err = deployCmd.RunDefault(f) |
| 714 | + framework.ExpectNoError(err) |
| 715 | + |
| 716 | + // Expect helm dependency update to be run. |
| 717 | + gomega.Expect(output.String()).To( |
| 718 | + gomega.ContainSubstring("helm dependency update"), |
| 719 | + ) |
| 720 | + }) |
| 721 | + |
| 722 | + ginkgo.It("should run helm dependency update on dependency's local chart name and path", func() { |
| 723 | + tempDir, err := framework.CopyToTempDir("tests/deploy/testdata/helm_git_dependency_with_local_chart") |
| 724 | + framework.ExpectNoError(err) |
| 725 | + defer framework.CleanupTempDir(initialDir, tempDir) |
| 726 | + |
| 727 | + ns, err := kubeClient.CreateNamespace("deploy") |
| 728 | + framework.ExpectNoError(err) |
| 729 | + defer func() { |
| 730 | + err := kubeClient.DeleteNamespace(ns) |
| 731 | + framework.ExpectNoError(err) |
| 732 | + }() |
| 733 | + |
| 734 | + // create a new dev command |
| 735 | + output := &bytes.Buffer{} |
| 736 | + deployCmd := &cmd.RunPipelineCmd{ |
| 737 | + GlobalFlags: &flags.GlobalFlags{ |
| 738 | + NoWarn: true, |
| 739 | + Namespace: ns, |
| 740 | + ConfigPath: "devspace-path.yaml", |
| 741 | + }, |
| 742 | + Pipeline: "deploy", |
| 743 | + Log: log.NewStreamLogger(output, output, logrus.DebugLevel), |
| 744 | + } |
| 745 | + |
| 746 | + // run the command |
| 747 | + err = deployCmd.RunDefault(f) |
| 748 | + framework.ExpectNoError(err) |
| 749 | + |
| 750 | + // Expect helm dependency update to be run. |
| 751 | + gomega.Expect(output.String()).To( |
| 752 | + gomega.ContainSubstring("helm dependency update"), |
| 753 | + ) |
| 754 | + }) |
682 | 755 | }) |
0 commit comments