Skip to content

Draft: Revamp Gitaly tests

Balasankar 'Balu' C requested to merge 6699-revamp-gitaly-tests into master

What does this MR do?

Cleanup Gitaly tests to match recipe structure.

gitaly::enable
  by default
    includes gitaly::enable recipe
    creates expected directories with correct permissions
    deletes the old internal sockets directory
    creates env directory with default variables
    populates gitaly config.toml with defaults
    renders the runit run script with defaults
    does not append timestamp in logs
    creates a default VERSION file and restarts service
    creates a default RUBY_VERSION file and restarts service
    behaves like enabled runit service
      creates directories
      creates files
      verifies that file ownership persists
      raises an error when file ownership does not persist
      creates the symlink to the service directory
      gitlab customization
        sets the supervise log files with correct permissions
    consul service discovery
      by default
        is not registered as consul service
      when enabled
        is registered as a consul service with default name
        with user specified service name
          is registered as a consul service with user specified name
  with user specified values
    creates expected directories with correct permissions
    creates env directory with specified and computed variables along with default variables
    populates config file with user specified values for general settings
    populates config file with user specified values for tls settings
    populates config file with user specified values for logging settings
    populates config file with user specified values for prometheus settings
    populates config file with user specified values for auth settings
    populates config file with user specified values for gitaly-ruby settings
    populates config file with user specified values for hooks settings
    populates config file with user specified values for pack_objects_cache settings
    renders the runit run script with user specified values
    appends timestamp in logs
    storage settings
      when specified via gitaly storages
        populates config file with user specified values for storage settings
      when specified via git_data_dirs
        using local gitaly
          computes Gitaly storages with user specified values and populates config file
        using external gitaly
          computes Gitaly storages with user specified values and populates config file
    git settings
      populates config file with user specified values
      gitconfig section
        with default values
          does not write a git.config section
        with ignore_gitconfig turned on
          with user specified omnibus gitconfig
            with values same as default values
              does not write a git.config section
            with values same as default values but with weird spacing
              does not write a git.config section
            with mix of default and non-default values
              writes a git.config section with only non-default values
          with user specified gitaly gitconfig
            set to empty array
              does not write a git.config section
            along with omnibus gitconfig being a mix of default and non-default values
              writes a git.config section with only values in gitaly gitconfig
    gitlab settings
      populates config file with user specified values
      when GitLab available under relative URL
        populates config file with user specified values
      workhorse listening on non-default locations
        over unix socket
          with only a listen address set
            populates config file with user specified values
          with only a socket directory set
            populates config file with user specified values
          with a listen_address and a sockets_directory set
            populates config file with user specified values
        over tcp
          populates config file with user specified values
    concurrency settings
      when concurrency configuration is valid
        populates config file with user specified values
      when concurrency configuration is empty
        populates config file without concurrency settings
    rate limiting settings
      when rate limiting configuration is valid
        populates config file with user specified values
      when rate limiting configuration is empty
        populates config file without rate limiting settings
      when rate limiting configuration is incomplete
        when interval is missing
          populates config file without rate limiting settings
        when burst is missing
          populates config file without rate limiting settings
    daily maintenance settings
      when explicitly disabled
        populates config file without daily maintenance settings
      when using single maintenance storage entry
        populates config file with user specified values
      when using multiple maintenance storage entries
        populates config file with user specified values
    cgroup settings
      using pre-15.0 cgroup settings
        populates config file with user specified values
      using new cgroup settings
        populates config file with user specified values
        renders the runit run script with cgroup root creation
    behaves like enabled runit service
      creates directories
      creates files
      verifies that file ownership persists
      raises an error when file ownership does not persist
      creates the symlink to the service directory
      gitlab customization
        sets the supervise log files with correct permissions

gitaly::disable
  includes gitaly::disable recipe
  deletes consul service
  behaves like disabled runit service
    does not create directories
    does not create files
    runs the disable service ruby block

Gitaly
  by default
    provides settings needed for gitaly to run
    does not include known settings in the environment
  .gitaly_address
    by default
      returns correct value
    when Gitaly listens over tcp
      returns correct value
    when Gitaly listens over tls
      returns correct value
  .parse_git_data_dirs
    when git_data_dirs is not defined or empty
      populates correct value for repositories_storages
    using local Gitaly
      with complete git_data_dirs
        populates correct value for repositories_storages
      when entry in git_data_dirs does not have path
        populates correct value for repositories_storages
    when using external Gitaly
      with complete git_data_dirs
        populates correct value for repositories_storages
      when entry in git_data_dirs does not have path
        populates correct value for repositories_storages

Related issues

#6699

Checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion

Required

  • Merge Request Title, and Description are up to date, accurate, and descriptive
  • MR targeting the appropriate branch
  • MR has a green pipeline on GitLab.com
  • Pipeline is green on dev.gitlab.org if the change is touching anything besides documentation or internal cookbooks
  • trigger-package has a green pipeline running against latest commit

Expected (please provide an explanation if not completing)

  • Test plan indicating conditions for success has been posted and passes
  • Documentation created/updated
  • Tests added
  • Integration tests added to GitLab QA
  • Equivalent MR/issue for the GitLab Chart opened
Edited by Balasankar 'Balu' C

Merge request reports