Skip to content

RFC 697: Testing - Code intelligence 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 intelligence-specific test scenarios.

Core story (altered for code intelligence specifics):

Prior to upgrading, run the upload portion of the codeintel-qa suite so that precise data exists.

Note: oobmigrations.yaml should be edited so that the introduced version of code intelligence-related oobmigrations start after the original version, as all existing code intelligence oobmigrations start prior to 3.29. In order to ensure that the migrator has a chance to run the oobmigrations that the instance hasn't finished, this should be changed locally prior to the test.

  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 intelligence migration test: Run the query portion of the codeintel-qa suite
  9. Code intelligence feature test: Upload an index for another repository and ensure that precise intel is available

Instructions:

  1. Start a local instance of Sourcegraph at version 3.35.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.35 --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.

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/postgres-12-alpine
    volumes:
      - 'pgsql-codeinsights:/data'
    ports:
      - 7779:5432
    networks:
      - sourcegraph

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

networks:
  sourcegraph: