Skip to content

Commit d94e4e7

Browse files
committed
Added tests for projects that utilize solver V2 and solver V3.
1 parent e554f37 commit d94e4e7

File tree

2 files changed

+127
-0
lines changed

2 files changed

+127
-0
lines changed

internal/testhelpers/tagsuite/tagsuite.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ const (
7979
Service = "service"
8080
Shell = "shell"
8181
Show = "show"
82+
SolverV2 = "solver-v2"
83+
SolverV3 = "solver-v3"
8284
Switch = "switch"
8385
Uninstall = "uninstall"
8486
Upgrade = "upgrade"

test/integration/install_int_test.go

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package integration
22

33
import (
4+
"path/filepath"
45
"strings"
56
"testing"
67

@@ -131,6 +132,130 @@ func (suite *InstallIntegrationTestSuite) TestInstall_Resolved() {
131132
cp.ExpectExitCode(0)
132133
}
133134

135+
func (suite *InstallIntegrationTestSuite) TestInstall_SolverV2() {
136+
suite.OnlyRunForTags(tagsuite.Install, tagsuite.SolverV2)
137+
ts := e2e.New(suite.T(), false)
138+
defer ts.Close()
139+
140+
tests := []struct {
141+
Name string
142+
Namespace string
143+
Package string
144+
ExpectedFail bool
145+
}{
146+
{
147+
"Python-Camel",
148+
"ActiveState-CLI/Python3#971e48e4-7f9b-44e6-ad48-86cd03ffc12d",
149+
"requests",
150+
false,
151+
},
152+
{
153+
"Python-Alternative",
154+
"ActiveState-CLI/Python3-Alternative#c2b3f176-4788-479c-aad3-8359d28ba3ce",
155+
"requests",
156+
false,
157+
},
158+
{
159+
"Perl-Camel",
160+
"ActiveState-CLI/Perl#a0a1692e-d999-4763-b933-2d0d5758bf12",
161+
"JSON",
162+
false,
163+
},
164+
{
165+
"Perl-Alternative",
166+
"ActiveState-CLI/Perl-Alternative#ccc57e0b-fccf-41c1-8e1c-24f4de2e55fa",
167+
"JSON",
168+
false,
169+
},
170+
{
171+
"Ruby-Alternative",
172+
"ActiveState-CLI/ruby#b6540776-7f2c-461b-8924-77fe46669209",
173+
"base64",
174+
false,
175+
},
176+
}
177+
178+
cp := ts.Spawn("config", "set", constants.AsyncRuntimeConfig, "true")
179+
cp.ExpectExitCode(0)
180+
181+
for _, tt := range tests {
182+
suite.Run(tt.Name, func() {
183+
ts := e2e.New(suite.T(), false)
184+
defer ts.Close()
185+
186+
cp = ts.Spawn("checkout", tt.Namespace, tt.Name)
187+
cp.ExpectExitCode(0)
188+
189+
cp = ts.SpawnWithOpts(
190+
e2e.OptArgs("install", tt.Package),
191+
e2e.OptWD(filepath.Join(ts.Dirs.Work, tt.Name)),
192+
)
193+
if !tt.ExpectedFail {
194+
cp.ExpectExitCode(0, e2e.RuntimeSolvingTimeoutOpt)
195+
} else {
196+
cp.ExpectNotExitCode(0, e2e.RuntimeSolvingTimeoutOpt)
197+
}
198+
})
199+
}
200+
201+
}
202+
203+
func (suite *InstallIntegrationTestSuite) TestInstall_SolverV3() {
204+
suite.OnlyRunForTags(tagsuite.Install, tagsuite.SolverV3)
205+
ts := e2e.New(suite.T(), false)
206+
defer ts.Close()
207+
208+
tests := []struct {
209+
Name string
210+
Namespace string
211+
Package string
212+
ExpectedFail bool
213+
}{
214+
{
215+
"Python",
216+
"ActiveState-CLI/Python3-Alternative-V3#c2b3f176-4788-479c-aad3-8359d28ba3ce",
217+
"requests",
218+
false,
219+
},
220+
{
221+
"Perl",
222+
"ActiveState-CLI/Perl-Alternative-V3#ccc57e0b-fccf-41c1-8e1c-24f4de2e55fa",
223+
"JSON",
224+
false,
225+
},
226+
{
227+
"Ruby",
228+
"ActiveState-CLI/ruby-V3#b6540776-7f2c-461b-8924-77fe46669209",
229+
"base64",
230+
true,
231+
},
232+
}
233+
234+
for _, tt := range tests {
235+
suite.Run(tt.Name, func() {
236+
ts := e2e.New(suite.T(), false)
237+
defer ts.Close()
238+
239+
cp := ts.Spawn("config", "set", constants.AsyncRuntimeConfig, "true")
240+
cp.ExpectExitCode(0)
241+
242+
cp = ts.Spawn("checkout", tt.Namespace, tt.Name)
243+
cp.ExpectExitCode(0)
244+
245+
cp = ts.SpawnWithOpts(
246+
e2e.OptArgs("install", tt.Package),
247+
e2e.OptWD(filepath.Join(ts.Dirs.Work, tt.Name)),
248+
)
249+
if !tt.ExpectedFail {
250+
cp.ExpectExitCode(0, e2e.RuntimeSolvingTimeoutOpt)
251+
} else {
252+
cp.ExpectNotExitCode(0, e2e.RuntimeSolvingTimeoutOpt)
253+
}
254+
})
255+
}
256+
257+
}
258+
134259
func TestInstallIntegrationTestSuite(t *testing.T) {
135260
suite.Run(t, new(InstallIntegrationTestSuite))
136261
}

0 commit comments

Comments
 (0)