1. 06 Jun, 2020 4 commits
    • Georges Racinet's avatar
      Heptapod: reworked services management API · a88a65e5c368
      Georges Racinet authored
      Finally settled to `gitlab_ctl()` to express both
      management of all services and of a sublist of services.
      
      The naming and behaviour is more intuitive than the `ctl_services`,
      and it matches the Omnibus (hence Docker) CLI.
      a88a65e5c368
    • Georges Racinet's avatar
      Giving some time to test_hashed_storage_migration · ed3d9dfe355d
      Georges Racinet authored
      All the rake task does is to "enqueue" the migration task, which
      itself will spawn even more workers.
      
      Therefore, it's necessary to `wait_assert()`. This explains why
      this test has been regularly failing except on empty instances.
      
      The asynchronicity seems to be even stronger on GitLab 12.10.
      ed3d9dfe355d
    • Georges Racinet's avatar
      session: avoid a webdriver leak and removed duplication · 9aeb60aea2ea
      Georges Racinet authored
      `login_as_user()` would not store the webdriver anywhere, hence
      it wouldn't be properly closed.
      It is currently used in `test_external_user_can_create_project()`
      
      With this change, it relies on the centralized mechanism currently
      provided by the `Heptapod` object, with the result that the
      webdriver is also stored there and gets automatically cleaned up
      at the end of the session.
      9aeb60aea2ea
    • Georges Racinet's avatar
      Better detection and cleanup in creation test by external user · 0ab9dbd37a6a
      Georges Racinet authored
      To recall, in this test, the user has no quota to create personal
      projects, but can still create a project in a group.
      
      In some cases (and especially on the future GitLab 12.10), the
      removal of the group wouldn't remove the just created project, or
      at least not right away, making subsequent runs fail because there's
      already a project with that name. We could have made the project
      name unique, but it's better to leak less and to tighten the detection.
      0ab9dbd37a6a
  2. 05 Jun, 2020 14 commits
    • Georges Racinet's avatar
      Project: converted access to Heptapod users to the new style · 9faf3a9694ca
      Georges Racinet authored
      This is a step towards having only User instances on the Heptapod
      object.
      9faf3a9694ca
    • Georges Racinet's avatar
      Heptapod: preparing to store User instances · 31054df34fdf
      Georges Racinet authored
      Having real `User` instances on the `Heptapod` object has been
      on the radar since the `User` class was created.
      
      Many places in the test utils and at most a few in the tests
      themselves access the `Heptapod.users` dictionary.
      
      It's therefore a bit too much for now to convert all these to
      fetch a User instance directly, but the new `Heptapod.get_user()`
      method will help us transitioning progressively.
      31054df34fdf
    • Georges Racinet's avatar
      User.token_headers() · 6cffadeb99cd
      Georges Racinet authored
      This is obviously the right place to mutualize the API token logic.
      Forfunately, token headers creation is not spread all over the
      tests, just in a few helper classes
      6cffadeb99cd
    • Georges Racinet's avatar
      Preparations: simplified root user info and token setup · 0c7dfea61d61
      Georges Racinet authored
      It makes more sense to set the root user once (and in the uniform
      way provided by the User class), to ensure its token immediately
      and to just assume that in the subsequent setups.
      
      Notably `session.login_as_root()` might simply not be called at all
      in the current test run.
      0c7dfea61d61
    • Georges Racinet's avatar
      Preparations: made root webdriver lazy · 7db10f33198d
      Georges Racinet authored
      This is a bit different than for regular users, since
      we have potentially the root password first initialization
      sequence.
      7db10f33198d
    • Georges Racinet's avatar
      Preparations: made webdriver for basic user lazy · f8b865f4cc43
      Georges Racinet authored
      This already saves us 5s at each startup.
      
      - `session.ensure_user()` doesn't initialize a webdriver any more.
      - `Heptapod.get_user_webdriver()` creates the driver if needed
        and stores it
      - `User.ensure_private_token()` now uses `Heptapod.get_user_webdriver()`
        instead of taking a webdriver argument
      f8b865f4cc43
    • Georges Racinet's avatar
      Central method to get a user webdriver · 7fb8d5a12719
      Georges Racinet authored
      After this change, no test gets a webdriver directly
      from the dict on Heptapod object, opening the road to
      make webdriver initialization lazy.
      7fb8d5a12719
    • Georges Racinet's avatar
      Preparations: caching user access tokens · 5f5ce18ee546
      Georges Racinet authored
      These can't be read with a webdriver, as it is a security feature
      of GitLab not to display them, that's why we where creating new
      ones for each session.
      
      Storing them in a cache file will help making the session startup
      time shorter. This is especially useful if launching a few tests
      repeatedly or with the tests that have to redo the preparations after
      an instance restart.
      5f5ce18ee546
    • Georges Racinet's avatar
      User: new api_get method · 952e922d9db5
      Georges Racinet authored
      Can be used to obtain more information about the user, and also
      to test that an existing access token is working.
      952e922d9db5
    • Georges Racinet's avatar
      Session: moved user personal token generation to User class · b0029b6dec0c
      Georges Racinet authored
      A prelude to forthcoming changes to cache it.
      
      the `create()` class method will automatically store the user
      information in the Heptapod instance, but `search()` won't,
      because it doesn't have the password information (but its caller
      might)
      b0029b6dec0c
    • Georges Racinet's avatar
      Session: fixed long false docstring · c3c23d133a8b
      Georges Racinet authored
      c3c23d133a8b
    • Georges Racinet's avatar
      User: separate class method to make the root User instance · 2c804ca57156
      Georges Racinet authored
      Having name and id harcoded, it's better to have a single method
      in case we'd want to hardcode less or change things.
      2c804ca57156
    • Georges Racinet's avatar
      User: nicer repr() · 68c3ffafbb62
      Georges Racinet authored
      We don't need to repeat the Heptapod instance in all log messages,
      nor the password
      68c3ffafbb62
    • Georges Racinet's avatar
      Preparations: timed test users management · d0cc38e2434c
      Georges Racinet authored
      These preparations (signed-in webdriver, personal access token)
      are only done once per session, but if the session is comprised of
      only a few tests, they can represent a good chunk of the run time.
      
      For example, launching the only current test in test_wikis.py,
      they represent 45% of the total time (on a warmed up GDK Heptapod
      based on GitLab 12.10).
      d0cc38e2434c
  3. 03 Jun, 2020 12 commits
    • Georges Racinet's avatar
      Heptapod: fixed `restart_rails()` · 1443aca07e8c
      Georges Racinet authored
      It is for now only used in Docker mode, that's why the obviously
      lack of command was there.
      1443aca07e8c
    • Georges Racinet's avatar
      Project: new `api_retrieve()` classmethod · f9fe6fbf54b7
      Georges Racinet authored
      This is more direct than `webdriver_retrieve()`, with the usual
      benefits of API methods: performance and stability
      
      In this particular case, we were relying on the full session cookie
      to be accepted in the API, which is not guaranteed to be acceptable
      in the long run.
      
      At this point `webdriver_retrieve()` is not called any more, but
      we're not removing it right away.
      f9fe6fbf54b7
    • Georges Racinet's avatar
      Project: split and transformed `retrieve` into a classmethod · 78434c68466d
      Georges Racinet authored
      The `wait_availability` kwarg is replaced by the separate
      `wait_hg_availability()` method, so that it can also be
      used with other project retrieval methods that we're going
      to add.
      78434c68466d
    • Georges Racinet's avatar
      Project.webdriver_destroy: simpler check for effective destruction · cd10f4a320ef
      Georges Racinet authored
      It's a good thing not to rely on webdriver methods for this, as it
      is faster and more stable.
      cd10f4a320ef
    • Georges Racinet's avatar
      Reduced logging noise from concurrency control code · 115128936034
      Georges Racinet authored
      Keeping logs about tests claiming thread monopoly at the INFO
      level, but ordinary tests signaling can be pushed down to DEBUG.
      115128936034
    • Georges Racinet's avatar
      DockerHeptapod: use backup methods from base class · c9100ec2a964
      Georges Racinet authored
      By implementing the new primitives, we can now leverage the base
      implementation of `backup_create()` and `backup_restore()` (which
      were largely derived from the first implementation in
      `DockerHeptapod` anyway)
      c9100ec2a964
    • Georges Racinet's avatar
      Backups: also testing on GDK installations · b81a192e8a51
      Georges Racinet authored
      All they need are services management and rake capability,
      previously only available for Docker installations.
      b81a192e8a51
    • Georges Racinet's avatar
      Running the tests for GDK installations · 554378d00e82
      Georges Racinet authored
      The `--heptapod-gdk` option declares the test to be launched
      in GDK context, leading to the new `GdkHeptapod` class to be
      instantiated, with the GDK root dir specified with `--heptapod-gdk-root`.
      
      The new `needs.services` decorator will allow to declare tests that need
      services (and rake) management, hence will be satisfied more broadly than
      the `docker` marker. Notably these tests won't be skipped in GDK context.
      554378d00e82
    • Georges Racinet's avatar
      conftest: reorder boolean variables · fff421a1f0ee
      Georges Racinet authored
      Just for readability
      fff421a1f0ee
    • Georges Racinet's avatar
      Heptapod: providing `restart_rails()` in the base class · daf358925926
      Georges Racinet authored
      The only caller at the time being is its sibling method
      `apply_hashed_storage_setting()`, that will hence become
      available for all concrete subclasses that implement
      `ctl_services()`.
      daf358925926
    • Georges Racinet's avatar
      New GdkHeptapod concrete class · c0a71291b3ac
      Georges Racinet authored
      It derives from SourceHeptapod, only adding service management
      and rake capabilities, hence being able to support backup tests
      and other tests that require service management.
      c0a71291b3ac
    • Georges Racinet's avatar
      Heptapod: backup handling impl in the abstract base class · 4316399e1320
      Georges Racinet authored
      Instead of just declaring `backup_create()` and `backup_restore()`,
      we implement them generically, relying on a new set of primitives
      to be implemented in subclasses:
      
      - `ctl_services()`: service management
      - `RAILS_SERVICES`: class attribute listing the Rails app services
        (web and background). These will be different in the Docker and
        GDK cases.
      - `rake()`
      - `remove_all_backups()`
      4316399e1320
  4. 02 Jun, 2020 1 commit
  5. 29 May, 2020 1 commit
  6. 27 May, 2020 2 commits
  7. 09 May, 2020 2 commits
  8. 24 May, 2020 1 commit
  9. 22 May, 2020 1 commit
    • Georges Racinet's avatar
      hg: allow passing preencoded command arguments · 3a0317f9aa04
      Georges Racinet authored
      This will be necessary for tests about content that's
      not encoded with the current default encoding.
      
      Because of this, the output might not be utf-8 either. For now,
      just avoiding an error is good enough.
      3a0317f9aa04
  10. 23 May, 2020 1 commit
  11. 21 May, 2020 1 commit