Skip to content

Commit

Permalink
Added tests for projects that utilize solver V2 and solver V3.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchell-as committed Dec 13, 2024
1 parent e554f37 commit d94e4e7
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/testhelpers/tagsuite/tagsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ const (
Service = "service"
Shell = "shell"
Show = "show"
SolverV2 = "solver-v2"
SolverV3 = "solver-v3"
Switch = "switch"
Uninstall = "uninstall"
Upgrade = "upgrade"
Expand Down
125 changes: 125 additions & 0 deletions test/integration/install_int_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package integration

import (
"path/filepath"
"strings"
"testing"

Expand Down Expand Up @@ -131,6 +132,130 @@ func (suite *InstallIntegrationTestSuite) TestInstall_Resolved() {
cp.ExpectExitCode(0)
}

func (suite *InstallIntegrationTestSuite) TestInstall_SolverV2() {
suite.OnlyRunForTags(tagsuite.Install, tagsuite.SolverV2)
ts := e2e.New(suite.T(), false)
defer ts.Close()

tests := []struct {
Name string
Namespace string
Package string
ExpectedFail bool
}{
{
"Python-Camel",
"ActiveState-CLI/Python3#971e48e4-7f9b-44e6-ad48-86cd03ffc12d",
"requests",
false,
},
{
"Python-Alternative",
"ActiveState-CLI/Python3-Alternative#c2b3f176-4788-479c-aad3-8359d28ba3ce",
"requests",
false,
},
{
"Perl-Camel",
"ActiveState-CLI/Perl#a0a1692e-d999-4763-b933-2d0d5758bf12",
"JSON",
false,
},
{
"Perl-Alternative",
"ActiveState-CLI/Perl-Alternative#ccc57e0b-fccf-41c1-8e1c-24f4de2e55fa",
"JSON",
false,
},
{
"Ruby-Alternative",
"ActiveState-CLI/ruby#b6540776-7f2c-461b-8924-77fe46669209",
"base64",
false,
},
}

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

for _, tt := range tests {
suite.Run(tt.Name, func() {
ts := e2e.New(suite.T(), false)
defer ts.Close()

cp = ts.Spawn("checkout", tt.Namespace, tt.Name)
cp.ExpectExitCode(0)

cp = ts.SpawnWithOpts(
e2e.OptArgs("install", tt.Package),
e2e.OptWD(filepath.Join(ts.Dirs.Work, tt.Name)),
)
if !tt.ExpectedFail {
cp.ExpectExitCode(0, e2e.RuntimeSolvingTimeoutOpt)
} else {
cp.ExpectNotExitCode(0, e2e.RuntimeSolvingTimeoutOpt)
}
})
}

}

func (suite *InstallIntegrationTestSuite) TestInstall_SolverV3() {
suite.OnlyRunForTags(tagsuite.Install, tagsuite.SolverV3)
ts := e2e.New(suite.T(), false)
defer ts.Close()

tests := []struct {
Name string
Namespace string
Package string
ExpectedFail bool
}{
{
"Python",
"ActiveState-CLI/Python3-Alternative-V3#c2b3f176-4788-479c-aad3-8359d28ba3ce",
"requests",
false,
},
{
"Perl",
"ActiveState-CLI/Perl-Alternative-V3#ccc57e0b-fccf-41c1-8e1c-24f4de2e55fa",
"JSON",
false,
},
{
"Ruby",
"ActiveState-CLI/ruby-V3#b6540776-7f2c-461b-8924-77fe46669209",
"base64",
true,
},
}

for _, tt := range tests {
suite.Run(tt.Name, func() {
ts := e2e.New(suite.T(), false)
defer ts.Close()

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

cp = ts.Spawn("checkout", tt.Namespace, tt.Name)
cp.ExpectExitCode(0)

cp = ts.SpawnWithOpts(
e2e.OptArgs("install", tt.Package),
e2e.OptWD(filepath.Join(ts.Dirs.Work, tt.Name)),
)
if !tt.ExpectedFail {
cp.ExpectExitCode(0, e2e.RuntimeSolvingTimeoutOpt)
} else {
cp.ExpectNotExitCode(0, e2e.RuntimeSolvingTimeoutOpt)
}
})
}

}

func TestInstallIntegrationTestSuite(t *testing.T) {
suite.Run(t, new(InstallIntegrationTestSuite))
}

0 comments on commit d94e4e7

Please sign in to comment.