github.com/argoproj/argo-cd/v3@v3.2.1/test/e2e/oci_test.go (about)

     1  package e2e
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/argoproj/gitops-engine/pkg/health"
     7  	. "github.com/argoproj/gitops-engine/pkg/sync/common"
     8  
     9  	. "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
    10  	"github.com/argoproj/argo-cd/v3/test/e2e/fixture"
    11  	. "github.com/argoproj/argo-cd/v3/test/e2e/fixture/app"
    12  )
    13  
    14  func TestOCIImage(t *testing.T) {
    15  	Given(t).
    16  		RepoURLType(fixture.RepoURLTypeOCI).
    17  		PushImageToOCIRegistry("testdata/guestbook", "1.0.0").
    18  		OCIRepoAdded("guestbook", "guestbook").
    19  		Revision("1.0.0").
    20  		OCIRegistry(fixture.OCIHostURL).
    21  		OCIRegistryPath("guestbook").
    22  		Path(".").
    23  		When().
    24  		CreateApp().
    25  		Then().
    26  		Expect(SyncStatusIs(SyncStatusCodeOutOfSync)).
    27  		Expect(Success("")).
    28  		When().
    29  		Sync().
    30  		Then().
    31  		Expect(Success("")).
    32  		Expect(OperationPhaseIs(OperationSucceeded)).
    33  		Expect(SyncStatusIs(SyncStatusCodeSynced)).
    34  		Expect(HealthIs(health.HealthStatusHealthy))
    35  }
    36  
    37  func TestOCIWithOCIHelmRegistryDependencies(t *testing.T) {
    38  	Given(t).
    39  		RepoURLType(fixture.RepoURLTypeOCI).
    40  		PushChartToOCIRegistry("testdata/helm-values", "helm-values", "1.0.0").
    41  		PushImageToOCIRegistry("testdata/helm-oci-with-dependencies", "1.0.0").
    42  		OCIRegistry(fixture.OCIHostURL).
    43  		OCIRepoAdded("helm-oci-with-dependencies", "helm-oci-with-dependencies").
    44  		OCIRegistryPath("helm-oci-with-dependencies").
    45  		Revision("1.0.0").
    46  		Path(".").
    47  		When().
    48  		CreateApp().
    49  		Then().
    50  		When().
    51  		Sync().
    52  		Then().
    53  		Expect(OperationPhaseIs(OperationSucceeded)).
    54  		Expect(HealthIs(health.HealthStatusHealthy)).
    55  		Expect(SyncStatusIs(SyncStatusCodeSynced))
    56  }
    57  
    58  func TestOCIWithAuthedOCIHelmRegistryDeps(t *testing.T) {
    59  	Given(t).
    60  		RepoURLType(fixture.RepoURLTypeOCI).
    61  		PushChartToAuthenticatedOCIRegistry("testdata/helm-values", "helm-values", "1.0.0").
    62  		PushImageToOCIRegistry("testdata/helm-oci-authed-with-dependencies", "1.0.0").
    63  		OCIRepoAdded("helm-oci-authed-with-dependencies", "helm-oci-authed-with-dependencies").
    64  		AuthenticatedOCIRepoAdded("helm-values", "myrepo/helm-values").
    65  		OCIRegistry(fixture.OCIHostURL).
    66  		OCIRegistryPath("helm-oci-authed-with-dependencies").
    67  		Revision("1.0.0").
    68  		Path(".").
    69  		When().
    70  		CreateApp().
    71  		Then().
    72  		When().
    73  		Sync().
    74  		Then().
    75  		Expect(OperationPhaseIs(OperationSucceeded)).
    76  		Expect(HealthIs(health.HealthStatusHealthy)).
    77  		Expect(SyncStatusIs(SyncStatusCodeSynced))
    78  }
    79  
    80  func TestOCIImageWithOutOfBoundsSymlink(t *testing.T) {
    81  	Given(t).
    82  		RepoURLType(fixture.RepoURLTypeOCI).
    83  		PushImageToOCIRegistry("testdata3/symlink-out-of-bounds", "1.0.0").
    84  		OCIRepoAdded("symlink-out-of-bounds", "symlink-out-of-bounds").
    85  		Revision("1.0.0").
    86  		OCIRegistry(fixture.OCIHostURL).
    87  		OCIRegistryPath("symlink-out-of-bounds").
    88  		Path(".").
    89  		When().
    90  		IgnoreErrors().
    91  		CreateApp().
    92  		Then().
    93  		Expect(Error("", "could not decompress layer: illegal filepath in symlink"))
    94  }