Page MenuHomePhabricator

Use an account for tests of RESTBase API at beta-cluster
Closed, ResolvedPublic

Description

There are a lot of tests of the RESTBase API at beta enwiki, like this http://en.wikipedia.beta.wmflabs.org/w/index.php?title=Save_test&curid=127114&diff=275555&oldid=275554

The Problem is, that this tests are flooding the recent changes, so it is hard to patrol the recent changes. So, is it possible, to make the test use an account? We could flag this account as bot, and then people like me can hide this account at the recent changes.

Event Timeline

Luke081515 raised the priority of this task from to Needs Triage.
Luke081515 updated the task description. (Show Details)
Luke081515 subscribed.

@Luke081515 this is actually one test, but it's executed quite often :)

There are several options here:

  1. MW API has a bot flag, and RESTBase supports setting it. I've just tried it, but apparently it's ignored for anonymous users. So we can create a bot account and make a test login, but this would require storing bots credentials in repository, and quite likely would cause issues in Travis and on fast tests reruns.
  2. We could switch this test to nock. All the rest of the save_api tests are already on nock, this one was left for sanity testing, but we can live without it.

I think #2 is a better path, it will also eliminate annoying 429 errors we have in Travis. @mobrovac, @GWicke, @Eevans, what do you think?

Yup, I'm for option #2 as well, been thinking about it for some time now. #1 poses a security problem, so I think it's out of the question.

travis-ci allows including encrypted data in your .travis.yml (see http://docs.travis-ci.com/user/encryption-keys), pywikibot uses it to store passwords for our test user.

If you create an account, I could flag it, so that is not the problem.

  1. MW API has a bot flag, and RESTBase supports setting it. I've just tried it, but apparently it's ignored for anonymous users.

Only users with the bot right can mark their edits as bot edits, and anonymous users are unlikely to have that right, yes.

The tests should be run locally too, so setting up encrypted auth doesn't seem to worth it.
Here's a PR that switches all tests to use mocks: https://github.com/wikimedia/restbase/pull/376

The PR was merged, now we will not create these pages on every test run, so the ticket can be closed.