github.com/verrazzano/verrazzano@v1.7.0/tools/charts-manager/vcm/tests/pkg/fakes/fakes.go (about)

     1  // Copyright (c) 2023, Oracle and/or its affiliates.
     2  // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
     3  
     4  package fakes
     5  
     6  import (
     7  	"github.com/verrazzano/verrazzano/tools/charts-manager/vcm/pkg/helm"
     8  	"github.com/verrazzano/verrazzano/tools/vz/pkg/helpers"
     9  )
    10  
    11  // FakeHelmChartFileSystem is a fake implemntation of fs.ChartFileSystem.
    12  type FakeHelmChartFileSystem struct {
    13  	FakeRearrangeChartDirectory    func(string, string, string) error
    14  	FakeSaveUpstreamChart          func(string, string, string, string) error
    15  	FakeSaveChartProvenance        func(string, *helm.ChartProvenance, string, string) error
    16  	FakeGeneratePatchFile          func(string, string, string) (string, error)
    17  	FakeGeneratePatchWithSourceDir func(string, string, string, string) (string, error)
    18  	FakeFindChartVersionToPatch    func(string, string, string) (string, error)
    19  	FakeApplyPatchFile             func(string, helpers.VZHelper, string, string, string) (bool, error)
    20  }
    21  
    22  // FakeHelmConfig is a fake implementation of helm.HelmConfig.
    23  type FakeHelmConfig struct {
    24  	FakeAddAndUpdateChartRepo func(string, string) (string, error)
    25  	FakeDownloadChart         func(string, string, string, string, string) error
    26  	FakeGetChartProvenance    func(string, string, string) (*helm.ChartProvenance, error)
    27  }
    28  
    29  // RearrangeChartDirectory is a fake implementation of fs.ChartFileSystem.RearrangeChartDirectory.
    30  func (hfs FakeHelmChartFileSystem) RearrangeChartDirectory(chartsDir string, chart string, targetVersion string) error {
    31  	return hfs.FakeRearrangeChartDirectory(chartsDir, chart, targetVersion)
    32  }
    33  
    34  // SaveUpstreamChart is a fake implementation of fs.ChartFileSystem.SaveUpstreamChart.
    35  func (hfs FakeHelmChartFileSystem) SaveUpstreamChart(chartsDir string, chart string, version string, targetVersion string) error {
    36  	return hfs.FakeSaveUpstreamChart(chartsDir, chart, version, targetVersion)
    37  }
    38  
    39  // SaveChartProvenance is a fake implementation of fs.ChartFileSystem.SaveChartProvenance.
    40  func (hfs FakeHelmChartFileSystem) SaveChartProvenance(chartsDir string, chartProvenance *helm.ChartProvenance, chart string, targetVersion string) error {
    41  	return hfs.FakeSaveChartProvenance(chartsDir, chartProvenance, chart, targetVersion)
    42  }
    43  
    44  // GeneratePatchFile is a fake implementation of fs.ChartFileSystem.GeneratePatchFile.
    45  func (hfs FakeHelmChartFileSystem) GeneratePatchFile(chartsDir string, chart string, version string) (string, error) {
    46  	return hfs.FakeGeneratePatchFile(chartsDir, chart, version)
    47  }
    48  
    49  // GeneratePatchWithSourceDir is a fake implementation of fs.ChartFileSystem.GeneratePatchWithSourceDir.
    50  func (hfs FakeHelmChartFileSystem) GeneratePatchWithSourceDir(chartsDir string, chart string, version string, sourceDir string) (string, error) {
    51  	return hfs.FakeGeneratePatchWithSourceDir(chartsDir, chart, version, sourceDir)
    52  }
    53  
    54  // FindChartVersionToPatch is a fake implementation of fs.ChartFileSystem.FindChartVersionToPatch.
    55  func (hfs FakeHelmChartFileSystem) FindChartVersionToPatch(chartsDir string, chart string, version string) (string, error) {
    56  	return hfs.FakeFindChartVersionToPatch(chartsDir, chart, version)
    57  }
    58  
    59  // ApplyPatchFile is a fake implementation of fs.ChartFileSystem.ApplyPatchFile.
    60  func (hfs FakeHelmChartFileSystem) ApplyPatchFile(chartsDir string, vzHelper helpers.VZHelper, chart string, version string, patchFile string) (bool, error) {
    61  	return hfs.FakeApplyPatchFile(chartsDir, vzHelper, chart, version, patchFile)
    62  }
    63  
    64  // AddAndUpdateChartRepo is a fake implementation of helm.HelmConfig.AddAndUpdateChartRepo.
    65  func (h FakeHelmConfig) AddAndUpdateChartRepo(chart string, repoURL string) (string, error) {
    66  	return h.FakeAddAndUpdateChartRepo(chart, repoURL)
    67  }
    68  
    69  // DownloadChart is a fake implementation of helm.HelmConfig.DownloadChart.
    70  func (h FakeHelmConfig) DownloadChart(chart string, repo string, version string, targetVersion string, chartDir string) error {
    71  	return h.FakeDownloadChart(chart, repo, version, targetVersion, chartDir)
    72  }
    73  
    74  // GetChartProvenance is a fake implementation of helm.HelmConfig.GetChartProvenance.
    75  func (h FakeHelmConfig) GetChartProvenance(chart string, repo string, version string) (*helm.ChartProvenance, error) {
    76  	return h.FakeGetChartProvenance(chart, repo, version)
    77  }