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

Add integration tests for project with complex package version requirements #2792

Closed
wants to merge 16 commits into from

Conversation

MDrakos
Copy link
Member

@MDrakos MDrakos commented Oct 4, 2023

BugDX-2241 UNINSTALL: ALL ST VERSIONS install/uninstall packages fail due build

@github-actions github-actions bot changed the base branch from master to version/0-42-0-RC1 October 4, 2023 22:49
@MDrakos
Copy link
Member Author

MDrakos commented Oct 5, 2023

Failing Windows integration tests are not related to this PR change.

@MDrakos MDrakos requested a review from Naatan October 5, 2023 21:32
Copy link
Member

@Naatan Naatan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, but my one gripe is I can't tell from the test itself what's being tested.

I'd recommend either adding comments or updating the tests themselves so it's clear what is being tested for.

Point being I don't know what I would do if this test started failing and/or needed updates.

@MDrakos
Copy link
Member Author

MDrakos commented Oct 11, 2023

I tried adding an import step with the requirements data that I used to set up the project but I kept running into timeout issues due to the project building. Instead, I've added a comment that hopefully helps understand what the test is doing. We could still run into timeout issues but it doesn't appear to be happening with the current project and test configuration.

The other windows failures are unrelated to the PR.

@MDrakos MDrakos requested a review from Naatan October 11, 2023 20:20
Copy link
Member

@Naatan Naatan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is testing what we want to test. We want to test that we can eg. state import a project with the given version constraints. Testing a project that was previously created isn't valid because it is the creation that is what we want to test.

@MDrakos
Copy link
Member Author

MDrakos commented Oct 11, 2023

What we want to test is that we can make modifications to a build expression that has complex version requirements, submit that, and get the expected response. The test I added mirrors how the bug surfaced. That said, the test you propose is also something worth having so I've added it.

Note that for the new test, I'm not verifying the version numbers because of the bug I filed earlier today: https://activestatef.atlassian.net/browse/DX-2272

@MDrakos MDrakos requested a review from Naatan October 11, 2023 22:19
Comment on lines +735 to +740
cp = ts.Spawn("packages")
cp.Expect("Mopidy-Dirble")
cp.Expect("coverage")
cp.Expect("docopt")
cp.Expect("requests")
cp.Expect("urllib3")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you can't use state packages and since verifying the version numbers is the point of this tests maybe instead we can use state history?

I don't see any point in adding the test as is because again it is not testing what it is set out to test.

Comment on lines +744 to +782
func (suite *PackageIntegrationTestSuite) TestProjectWithCustomVersionRequirements() {
suite.OnlyRunForTags(tagsuite.Package)
if runtime.GOOS == "windows" {
suite.T().Skip("Skipping windows as builds can be slow and we only really need to test this one one platform")
return
}
ts := e2e.New(suite.T(), false)
defer ts.Close()

// Because the ActiveState-CLI org has enterprise features enabled, we need to login
ts.LoginAsPersistentUser()

// This project was created with the following requirements.txt:
// coverage!=3.5
// docopt>=0.6.1
// Mopidy-Dirble>=1.1,<2
// requests>=2.2,<2.31.0
// urllib3>=1.21.1,<=1.26.5
cp := ts.Spawn("checkout", "ActiveState-CLI/Comparators", ".")
cp.Expect("Skipping runtime setup")
cp.Expect("Checked out project")
cp.ExpectExitCode(0)

// Uninstall all of the packages with custom version requirements
cp = ts.Spawn("uninstall", "coverage")
cp.ExpectExitCode(0)

cp = ts.Spawn("uninstall", "docopt")
cp.ExpectExitCode(0)

cp = ts.Spawn("uninstall", "Mopidy-Dirble")
cp.ExpectExitCode(0)

cp = ts.Spawn("uninstall", "requests")
cp.ExpectExitCode(0)

cp = ts.Spawn("uninstall", "urllib3")
cp.ExpectExitCode(0)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With your latest explanation I think I am caught up. This test should not exist. We are testing an API now, rather than the state tool. That's not our job, we have a hard enough time keeping our tests under control with just covering the State Tool itself.

The new test you added has value but does seem unrelated to the story at hand. Perhaps we should abandon the ticket and file a new one for the import test.

@MDrakos
Copy link
Member Author

MDrakos commented Oct 12, 2023

Closing in favor of: https://activestatef.atlassian.net/browse/DX-2276

@MDrakos MDrakos closed this Oct 12, 2023
@MDrakos MDrakos deleted the DX-2241 branch April 26, 2024 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants