Bitbucket server
This test plan serves the purpose of manually testing if critical functionality of Sourcegraph works with bitbucket server.
Prerequisites
- Sourcegraph instance running
- Site admin account created and functional
- No prior bitbucket server code host connection setup a. If you already have one, delete it before running this test plan b. Deleting is better than modifying, because it provides consistent path for everyone who follows the test plan
- No user with username
engineers
on the instance a. This is the user we will use from the bitbucket.sgdev.org instance, the username must match a sourcegraph user - Builtin auth provider is enabled in site configuration:
"auth.providers": [ { "type": "builtin", }, // there might be more auth providers, not important for this test ]
T1: Repository syncing works
- Go to
/site-admin/external-services
- Click on Add connection button
- Pick Bitbucket server from the list
- Add the following JSON config:
{ "url": "https://bitbucket.sgdev.org", "token": "REDACTED", "username": "engineers", "repos": [ "SGDEMO/sourcegraph", "SGDEMO/mux", "SGDEMO/jenkins", ], }
- For the token, copy the value of Token field from the shared 1Password vault
- Scroll down and click Add connection button
- Click Trigger manual sync button
- A new sync job should appear in the Recent sync jobs list
- Wait for the sync to finish. Make sure there are no errors on the sync job displayed in the Recent sync jobs list
- Go to
/site-admin/repositories
- In the Code host picker pick the bitbucket code host connection you added
- Make sure you see 3 repositories in the list:
SGDEMO/sourcegraph
SGDEMO/mux
SGDEMO/jenkins
- Go to
/search?q=context:global+repo:SGDEMO&patternType=standard&sm=1&groupBy=repo
- Make sure that you see the 3 repositories above in the search result list.
T2: Permission syncing works
T2.1: Regular users can see repos with no permission enforcement
- Go to
/site-admin/users
- Click on Create user
- For username, type in
engineers
, for email type in your own email with some +suffix, e.g.[email protected]
- Click on Create account and generate password reset link button at the bottom of the form
- You should see a message Account created for engineers.
- Click on Copy button to copy the reset password URL.
- Log out of the sourcegraph instance
- Paste the reset password URL you copied previously into the address field of the browser
- Follow the instructions to create the user account. Use a reasonable password and store the password somewhere, you will need it later on.
- Go to
/search?q=context:global+repo:SGDEMO&patternType=standard&sm=1&groupBy=repo
- Make sure that you see the 3 repositories in the search result list.
T2.2: Permission enforcement works correctly
- Logout and log back in as a site admin
- Go to
/site-admin/external-services
and click on Edit button for the bitbucket connection you created in T1 - Add the following JSON into the existing config:
"authorization": { "identityProvider": { "type": "username" }, "oauth": { "consumerKey": "the_key", "signingKey": "the_key" } },
- For
consumerKey
andsigningKey
fields copy the values from the shared 1Password vault - Go to
/bitbucket.sgdev.org/SGDEMO/sourcegraph/-/settings/permissions
- A permission sync job should appear in the Permission sync jobs list
- Wait for the permission sync to finish, this can take several seconds
- Check the Total column in the list, it should be non-zero as the
engineers
user should have access to the repository - Scroll down the page and look at the Users list (List of users who have access to the repository).
- Make sure that the
engineers
user appears in the list with Permissions Sync as a reason. - Logout and log back in as
engineers
user. - Go to
/users/engineers/settings/permissions
- Check that you can see 3 repositories in the Accessible Repositories list with Permissions Sync as a reason:
SGDEMO/sourcegraph
SGDEMO/mux
SGDEMO/jenkins
- Go to
/search?q=context:global+repo:SGDEMO&patternType=standard&sm=1&groupBy=repo
- Make sure that you see the 3 repositories above in the search result list.
T2.3: User with no bitbucket account does not see the repositories
- Logout and log back in as a site-admin
- Follow steps 1-9 from T2.1 test to create a different user that is not a site admin
- Go to
/users/YOUR_USERNAME/settings/permissions
- Check that the bitbucket repositories are not shown in the Accessible Repositories list
- Go to
/search?q=context:global+repo:SGDEMO&patternType=standard&sm=1&groupBy=repo
- Verify that you see no results.
Test runs
Test runs of this test plan are collected in the following spreadsheet.