Skip to content

RFC 697 Multiple version upgrades: Testing - Code insights user story

Created by: efritz

See RFC 697: Multiple version upgrades.

See the testing strategy announcement in slack.

This PR tracks general testing of multi-version upgrades as well as Code insights-specific test scenarios.

Core story (altered for code insights specifics):

Prior to upgrading, add dashboards/series configuration to site/org/user settings.

  1. Run a search for the sourcegraph/sourcegraph repository
  2. Search for the term GetUploads on HEAD
  3. Open a result and ensure the file renders
  4. Check that file sidebar and symbols sidebars are populated
  5. Ensure code navigation (go to definition and find references) work as expected
  6. Repeat steps 2-5 on an old tag to ensure that unindexed paths are also functional
  7. Visit each site-admin page to ensure there are no obvious error banners
  8. Code insights migration test: Ensure that the dashboards/series configured via site config are still available
  9. Code insights feature test: Create a new insight and ensure the feature works properly at the new version

Instructions:

  1. Start a local instance of Sourcegraph at version 3.34.0. The docker-compose.yaml artifact, below, provides an easy way to link a sourcegraph/server image with three container-based Postgres instances. The frontend, codeintel, and codeinsights databases are available on the host via ports 7777, 7778, and 7779, respectively.
  2. Perform whatever steps listed above that need to be performed prior to upgrading (available on the host via port 7080).
  3. Stop the sourcegraph/server container, but leave the three database containers running.
  4. In a clone of the sg/sg repo, run the following commands to upgrade your local instance to version 4.0.
export PGDATASOURCE=postgres://sg:[email protected]:7777/sg
export CODEINTEL_PGDATASOURCE=postgres://sg:[email protected]:7778/sg
export CODEINSIGHTS_PGDATASOURCE=postgres://sg:[email protected]:7779/sg

go run ./enterprise/cmd/migrator upgrade --from 3.34 --to 4.0
  1. Update the tag on the sourcegraph/server image to point to the "pre-release" of version 4.0. The particular commit that we're treating as the 4.0 release prior to the creation of the tag in git can be found here.

For code insights, it may be necessary to replace the pgsql-codeinsights image with sourcegraph/postgres-12-alpine when booting the new version (using the same volume mount).

Artifacts:

docker-compose.yaml:

version: '2.4'
services:
  sourcegraph:
    image: sourcegraph/server:{{TAG GOES HERE}}
    environment:
      - PGDATASOURCE=postgres://sg:sg@pgsql-frontend:5432/sg
      - CODEINTEL_PGDATASOURCE=postgres://sg:sg@pgsql-codeintel:5432/sg
      - CODEINSIGHTS_PGDATASOURCE=postgres://sg:sg@pgsql-codeinsights:5432/sg
    ports:
      - 7080:7080
    networks:
      - sourcegraph
    depends_on:
      - pgsql-frontend
      - pgsql-codeintel
      - pgsql-codeinsights

  pgsql-frontend:
    image: sourcegraph/postgres-12-alpine
    volumes:
      - 'pgsql-frontend:/data'
    ports:
      - 7777:5432
    networks:
      - sourcegraph

  pgsql-codeintel:
    image: sourcegraph/postgres-12-alpine
    volumes:
      - 'pgsql-codeintel:/data'
    ports:
      - 7778:5432
    networks:
      - sourcegraph

  pgsql-codeinsights:
    image: sourcegraph/codeinsights-db
    volumes:
      - 'pgsql-codeinsights:/data'
    ports:
      - 7779:5432
    networks:
      - sourcegraph

volumes:
  sourcegraph:
  pgsql-frontend:
  pgsql-codeintel:
  pgsql-codeinsights:

networks:
  sourcegraph: