Skip to content

mute unit tests that depend on the network - #5188

Merged
shiftkey merged 1 commit into
masterfrom
what-even-are-tests
Jul 19, 2018
Merged

shiftkey merged 1 commit into
masterfrom
what-even-are-tests

Conversation

@shiftkey

@shiftkey shiftkey commented Jul 18, 2018 •

Copy link
Copy Markdown
Member

In my eagerness to merge #5149 I overlooked that some of these tests depend on canAccessRepository - which actually hits the GitHub API.

async function canAccessRepository(
account: Account,
owner: string,
name: string
): Promise<boolean> {
const api = API.fromAccount(account)
const repository = await api.fetchRepository(owner, name)
if (repository) {
return true
} else {
return false
}
}

I had some failing tests in #5187 which were unrelated to the change:

  327 passing (35s)
  2 pending
  2 failing
  1) findAccountForRemoteURL
       finds the anonymous account for public GitHub owner/name repository:
      AssertionError: expected null to not equal null
      + expected - actual
      at Context.it (C:\projects\desktop\app\test\unit\find-account-test.ts:48:28)
      at <anonymous>
  2) findAccountForRemoteURL
       finds the account for GitHub owner/name repository:
      AssertionError: expected null to not equal null
      + expected - actual
      at Context.it (C:\projects\desktop\app\test\unit\find-account-test.ts:63:28)
      at <anonymous>

What I believe is happening is the GitHub API is rate-limiting the CI agents IP addresses, which means these tests fail incorrectly, and are not actually unit tests in the classic sense.

I'm going to mute all these tests for now with a note because I think we discussed this a bit in #4362 which is still in progress.

@shiftkey shiftkey added ready-for-review Pull Requests that are ready to be reviewed by the maintainers infrastructure Issues and pull requests related to scripts and tooling for GitHub Desktop labels Jul 18, 2018

@iAmWillShepherd iAmWillShepherd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perhaps we can move these types of test to our integration test folder in the future?

@iAmWillShepherd iAmWillShepherd self-assigned this Jul 18, 2018
@shiftkey

Copy link
Copy Markdown
Member Author

Perhaps we can move these types of test to our integration test folder in the future?

I'd rather just emulate the API behaviour in code and avoid having to ship valid credentials that CI and contributors can use when running the tests

@shiftkey

Copy link
Copy Markdown
Member Author

#jolo because it's now occurring to many PRs

@shiftkey
shiftkey merged commit 9b79d09 into master Jul 19, 2018
@shiftkey
shiftkey deleted the what-even-are-tests branch July 19, 2018 15:19
@lock lock Bot locked as resolved and limited conversation to collaborators Sep 17, 2018
@desktop desktop unlocked this conversation Sep 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure Issues and pull requests related to scripts and tooling for GitHub Desktop ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants