Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SNOW] Use ':' as a package namespace separator instead of '/'. #3340

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions internal/captain/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ func (u *UsersValue) Type() string {

// PackageValue represents a flag that supports specifying a package in the following formats:
// - <name>
// - <namespace>/<name>
// - <namespace>/<name>@<version>
// - <namespace>:<name>
// - <namespace>:<name>@<version>
type PackageValue struct {
Namespace string
Name string
Expand All @@ -137,7 +137,7 @@ func (p *PackageValue) String() string {
}
name := p.Name
if p.Namespace != "" {
name = fmt.Sprintf("%s/%s", p.Namespace, p.Name)
name = fmt.Sprintf("%s:%s", p.Namespace, p.Name)
}
if p.Version == "" {
return name
Expand All @@ -151,12 +151,12 @@ func (p *PackageValue) Set(s string) error {
p.Version = strings.TrimSpace(v[1])
s = v[0]
}
if !strings.Contains(s, "/") {
if !strings.Contains(s, ":") {
p.Name = strings.TrimSpace(s)
return nil
}
v := strings.Split(s, "/")
p.Namespace = strings.TrimSpace(strings.Join(v[0:len(v)-1], "/"))
v := strings.Split(s, ":")
p.Namespace = strings.TrimSpace(strings.Join(v[0:len(v)-1], ":"))
p.Name = strings.TrimSpace(v[len(v)-1])
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions internal/captain/values_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ func TestPackageValue_Set(t *testing.T) {
}{
{
"namespace, name and version",
"namespace/path/[email protected]",
"namespace/path:[email protected]",
false,
&PackageValue{Namespace: "namespace/path", Name: "name", Version: "1.0.0"},
},
{
"namespace and name",
"namespace/path/name",
"namespace/path:name",
false,
&PackageValue{Namespace: "namespace/path", Name: "name"},
},
Expand Down Expand Up @@ -99,13 +99,13 @@ func TestPackageFlagNSRequired_Set(t *testing.T) {
}{
{
"namespace, name and version",
"namespace/path/[email protected]",
"namespace/path:[email protected]",
false,
&PackageValueNSRequired{PackageValue{Namespace: "namespace/path", Name: "name", Version: "1.0.0"}},
},
{
"namespace and name",
"namespace/path/name",
"namespace/path:name",
false,
&PackageValueNSRequired{PackageValue{Namespace: "namespace/path", Name: "name"}},
},
Expand Down
26 changes: 6 additions & 20 deletions test/integration/package_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ func (suite *PackageIntegrationTestSuite) TestCVE_Indirect() {
cp.ExpectExitCode(0)

cp = ts.SpawnWithOpts(
e2e.OptArgs("install", "private/ActiveState-CLI-Testing/language/python/django_dep", "--ts=now"),
e2e.OptArgs("install", "org/cli-integration-tests/language/python:django_dep", "--ts=now"),
e2e.OptAppendEnv(constants.DisableRuntime+"=false"),
)
cp.ExpectRe(`Warning: Dependency has \d indirect known vulnerabilities`, e2e.RuntimeSourcingTimeoutOpt)
Expand All @@ -755,30 +755,16 @@ func (suite *PackageIntegrationTestSuite) TestCVE_Indirect() {
cp.ExpectExitCode(1)
}

func (suite *PackageIntegrationTestSuite) TestChangeSummary() {
suite.OnlyRunForTags(tagsuite.Package)
func (suite *InstallIntegrationTestSuite) TestNamespace() {
suite.OnlyRunForTags(tagsuite.Install)
ts := e2e.New(suite.T(), false)
defer ts.Close()

cp := ts.Spawn("config", "set", constants.AsyncRuntimeConfig, "true")
cp.Expect("Successfully set")
cp.ExpectExitCode(0)

cp = ts.Spawn("checkout", "ActiveState-CLI/small-python", ".")
cp.Expect("Checked out")
cp.ExpectExitCode(0)

cp = ts.SpawnWithOpts(
e2e.OptArgs("install", "[email protected]"),
ts.PrepareProject("ActiveState-CLI/small-python", "5a1e49e5-8ceb-4a09-b605-ed334474855b")
cp := ts.SpawnWithOpts(
e2e.OptArgs("install", "language/python:requests"),
e2e.OptAppendEnv(constants.DisableRuntime+"=false"),
)
cp.Expect("Resolving Dependencies")
cp.Expect("Done")
cp.Expect("Installing [email protected] includes 4 direct dependencies")
cp.Expect("├─ ")
cp.Expect("├─ ")
cp.Expect("├─ ")
cp.Expect("└─ ")
cp.Expect("Package added: requests", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)
}
Expand Down
Loading