Skip to content

Fix our git tests to actually test that we pushed #1532

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

Merged
merged 1 commit into from
Oct 24, 2018

Conversation

sgrif
Copy link
Contributor

@sgrif sgrif commented Oct 21, 2018

Our git tests aren't actually testing very much at the moment. We can
replace the entire body of commit_and_push with Ok(()), and the
test suite would pass. Right now all our tests do is check that we
manipulated files in a given directory, which is more of an
implementation detail than anything else.

Aside from not actually testing what we want, these tests also break
with the setup I want to use for async index updates. Once the index
updates are off the web server, there's no reason we need to keep a
local checkout of the index. We can afford to just do a full clone every
time, which simplifies our code. Once we do that though, our tests can't
observe the directory the commit was made in.

Pushing to a remote repository doesn't actually update the files you
changed on disk. Instead, to observe the changes that were committed, we
create a new clone of the repo and look at the files there. Almost all
of the tests are easy to change to this structure. One of our tests
manipulated a file in the location that it expected the server to
manipulate though. We'd have to push that for the test to be legit.
We could write a commit_and_push function for our tests, but that
function will be a pain in the ass. Instead we can just go though a full
crate upload twice to test what we want.

Our git tests aren't actually testing very much at the moment. We can
replace the entire body of `commit_and_push` with `Ok(())`, and the
test suite would pass. Right now all our tests do is check that we
manipulated files in a given directory, which is more of an
implementation detail than anything else.

Aside from not actually testing what we want, these tests also break
with the setup I want to use for async index updates. Once the index
updates are off the web server, there's no reason we need to keep a
local checkout of the index. We can afford to just do a full clone every
time, which simplifies our code. Once we do that though, our tests can't
observe the directory the commit was made in.

Pushing to a remote repository doesn't actually update the files you
changed on disk. Instead, to observe the changes that were committed, we
create a new clone of the repo and look at the files there. Almost all
of the tests are easy to change to this structure. One of our tests
manipulated a file in the location that it expected the server to
manipulate though. We'd have to push that for the test to be legit.
We could write a `commit_and_push` function for our tests, but that
function will be a pain in the ass. Instead we can just go though a full
crate upload twice to test what we want.
@sgrif sgrif requested a review from jtgeibel October 23, 2018 16:44
Copy link
Member

@jtgeibel jtgeibel left a comment

Choose a reason for hiding this comment

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

Everything LGTM

bors: r+

bors-voyager bot added a commit that referenced this pull request Oct 24, 2018
1532: Fix our git tests to actually test that we pushed r=jtgeibel a=sgrif

Our git tests aren't actually testing very much at the moment. We can
replace the entire body of `commit_and_push` with `Ok(())`, and the
test suite would pass. Right now all our tests do is check that we
manipulated files in a given directory, which is more of an
implementation detail than anything else.

Aside from not actually testing what we want, these tests also break
with the setup I want to use for async index updates. Once the index
updates are off the web server, there's no reason we need to keep a
local checkout of the index. We can afford to just do a full clone every
time, which simplifies our code. Once we do that though, our tests can't
observe the directory the commit was made in.

Pushing to a remote repository doesn't actually update the files you
changed on disk. Instead, to observe the changes that were committed, we
create a new clone of the repo and look at the files there. Almost all
of the tests are easy to change to this structure. One of our tests
manipulated a file in the location that it expected the server to
manipulate though. We'd have to push that for the test to be legit.
We could write a `commit_and_push` function for our tests, but that
function will be a pain in the ass. Instead we can just go though a full
crate upload twice to test what we want.

Co-authored-by: Sean Griffin <[email protected]>
@bors-voyager
Copy link
Contributor

bors-voyager bot commented Oct 24, 2018

Build succeeded

@bors-voyager bors-voyager bot merged commit 93b42fb into rust-lang:master Oct 24, 2018
@sgrif sgrif deleted the sg-fix-git-tests branch October 24, 2018 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants