Skip to content

Commit

Permalink
Added additional e2e testcases
Browse files Browse the repository at this point in the history
Signed-off-by: Yash Sethiya <[email protected]>
  • Loading branch information
sethiyash committed Feb 9, 2024
1 parent 2ea4a9f commit c91aaa1
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion cli/test/e2e/package_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestPackageRepository(t *testing.T) {
kubectl := Kubectl{t, env.Namespace, logger}

pkgrName := "test-package-repository"
pkgrURL := `index.docker.io/k8slt/kc-e2e-test-repo:latest`
pkgrURL := `ghcr.io/carvel-dev/kc-e2e-test-repo:latest`

newRepoNamespace := "carvel-test-repo-a"

Expand Down Expand Up @@ -193,3 +193,50 @@ func TestPackageRepository(t *testing.T) {
})

}

func TestPackageRepositoryTagSemver(t *testing.T) {
env := BuildEnv(t)
logger := Logger{}
kappCtrl := Kctrl{t, env.Namespace, env.KctrlBinaryPath, logger}
kubectl := Kubectl{t, env.Namespace, logger}

pkgrName := "test-package-repository"
pkgrURL := `ghcr.io/carvel-dev/kc-e2e-test-repo`

kind := "PackageRepository"

cleanUp := func() {
RemoveClusterResource(t, kind, pkgrName, env.Namespace, kubectl)
}

cleanUp()
defer cleanUp()

logger.Section("adding a repository", func() {
kappCtrl.Run([]string{"package", "repository", "add", "-r", pkgrName, "--url", pkgrURL + ":v1.0.0"})

kubectl.Run([]string{"get", kind, pkgrName})
kubectl.Run([]string{"get", "pkgm/pkg.test.carvel.dev"})
kubectl.Run([]string{"get", "pkg/pkg.test.carvel.dev.1.0.0"})
kubectl.Run([]string{"get", "pkg/pkg.test.carvel.dev.2.0.0"})
})

logger.Section("adding a repository", func() {
kappCtrl.Run([]string{"package", "repository", "delete", "-r", pkgrName})
})

logger.Section("adding a repository", func() {
out := kappCtrl.Run([]string{"package", "repository", "add", "-r", pkgrName, "--url", pkgrURL + ":v2.0.0", "--semver-tag-constraints", "1.0.0"})
t.Logf(out)
})

logger.Section("adding a repository", func() {
kappCtrl.Run([]string{"package", "repository", "add", "-r", pkgrName, "--url", pkgrURL, "--semver-tag-constraints", ">1.0.0"})

kubectl.Run([]string{"get", kind, pkgrName})
kubectl.Run([]string{"get", "pkgm/pkg.test.carvel.dev"})
kubectl.Run([]string{"get", "pkg/pkg.test.carvel.dev.1.0.0"})
kubectl.Run([]string{"get", "pkg/pkg.test.carvel.dev.2.0.0"})
})

}

0 comments on commit c91aaa1

Please sign in to comment.