From 132c90ebd595bbcc477034008a847789fae54071 Mon Sep 17 00:00:00 2001 From: Geoffrey Huntley Date: Wed, 25 Aug 2021 06:31:37 +0000 Subject: [PATCH 1/6] add test case for feature/JIRA-123-summary --- .../bitbucket-context-parser.spec.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/components/server/src/bitbucket/bitbucket-context-parser.spec.ts b/components/server/src/bitbucket/bitbucket-context-parser.spec.ts index 32f4b4df610dcd..611ff608662ae0 100644 --- a/components/server/src/bitbucket/bitbucket-context-parser.spec.ts +++ b/components/server/src/bitbucket/bitbucket-context-parser.spec.ts @@ -208,6 +208,26 @@ class TestBitbucketContextParser { }) } + @test public async testBranchContext_03() { + const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/sample-repository/branch/feature/JIRA-123-summary'); + expect(result).to.deep.include({ + "ref": "feature/JIRA-123-summary", + "refType": "branch", + "path": "", + "revision": "5a24a0c8a7b42c2e6418593d788e17cb987bda25", + "isFile": false, + "repository": { + "host": "bitbucket.org", + "owner": "gitpod", + "name": "sample-repository", + "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "defaultBranch": "master", + "private": false + }, + "title": "gitpod/sample-repository - feature/JIRA-123-summary" + }) + } + @test public async testCommitsContext_02() { const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/sample-repository/commits/tag/first-tag'); expect(result).to.deep.include({ From 0df455023fb29ee5787f4f07c5c147e229d1b931 Mon Sep 17 00:00:00 2001 From: Geoffrey Huntley Date: Sat, 28 Aug 2021 06:21:05 +0000 Subject: [PATCH 2/6] sample-repository has been renamed to integration-tests --- .../bitbucket-context-parser.spec.ts | 146 +++++++++--------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/components/server/src/bitbucket/bitbucket-context-parser.spec.ts b/components/server/src/bitbucket/bitbucket-context-parser.spec.ts index 611ff608662ae0..3e6d10057d6b28 100644 --- a/components/server/src/bitbucket/bitbucket-context-parser.spec.ts +++ b/components/server/src/bitbucket/bitbucket-context-parser.spec.ts @@ -61,7 +61,7 @@ class TestBitbucketContextParser { } @test public testCanHandleBitbucketRepo() { - expect(this.parser.canHandle(this.user, "https://bitbucket.org/gitpod/sample-repository/src/master/")).to.be.true; + expect(this.parser.canHandle(this.user, "https://bitbucket.org/gitpod/integration-tests/src/master/")).to.be.true; } @test public testCanNotHandleGitHubRepo() { @@ -69,7 +69,7 @@ class TestBitbucketContextParser { } @test public async testShortContext_01() { - const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/sample-repository'); + const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/integration-tests'); expect(result).to.deep.include({ "ref": "master", "refType": "branch", @@ -79,17 +79,17 @@ class TestBitbucketContextParser { "repository": { "host": "bitbucket.org", "owner": "gitpod", - "name": "sample-repository", - "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "name": "integration-tests", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests.git", "defaultBranch": "master", "private": false }, - "title": "gitpod/sample-repository - master" + "title": "gitpod/integration-tests - master" }) } @test public async testSrcContext_01() { - const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/sample-repository/src/master/'); + const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/integration-tests/src/master/'); expect(result).to.deep.include({ "ref": "master", "refType": "branch", @@ -99,17 +99,17 @@ class TestBitbucketContextParser { "repository": { "host": "bitbucket.org", "owner": "gitpod", - "name": "sample-repository", - "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "name": "integration-tests", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests.git", "defaultBranch": "master", "private": false }, - "title": "gitpod/sample-repository - master" + "title": "gitpod/integration-tests - master" }) } @test public async testSrcContext_02() { - const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/sample-repository/src/8fcf6c869d0cdb570bb6f2f9aa5f8ed72c9d953a/?at=Gitpod%2Ftesttxt-created-online-with-bitbucket-1589277871983'); + const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/integration-tests/src/8fcf6c869d0cdb570bb6f2f9aa5f8ed72c9d953a/?at=Gitpod%2Ftesttxt-created-online-with-bitbucket-1589277871983'); expect(result).to.deep.include({ "ref": "Gitpod/testtxt-created-online-with-bitbucket-1589277871983", "refType": "branch", @@ -119,17 +119,17 @@ class TestBitbucketContextParser { "repository": { "host": "bitbucket.org", "owner": "gitpod", - "name": "sample-repository", - "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "name": "integration-tests", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests.git", "defaultBranch": "master", "private": false }, - "title": "gitpod/sample-repository - Gitpod/testtxt-created-online-with-bitbucket-1589277871983" + "title": "gitpod/integration-tests - Gitpod/testtxt-created-online-with-bitbucket-1589277871983" }) } @test public async testSrcContext_03() { - const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/sample-repository/src/second-branch/'); + const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/integration-tests/src/second-branch/'); expect(result).to.deep.include({ "ref": "second-branch", "refType": "branch", @@ -139,17 +139,17 @@ class TestBitbucketContextParser { "repository": { "host": "bitbucket.org", "owner": "gitpod", - "name": "sample-repository", - "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "name": "integration-tests", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests.git", "defaultBranch": "master", "private": false }, - "title": "gitpod/sample-repository - second-branch" + "title": "gitpod/integration-tests - second-branch" }) } @test public async testCommitsContext_01() { - const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/sample-repository/commits/branch/second-branch'); + const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/integration-tests/commits/branch/second-branch'); expect(result).to.deep.include({ "ref": "second-branch", "refType": "branch", @@ -159,17 +159,17 @@ class TestBitbucketContextParser { "repository": { "host": "bitbucket.org", "owner": "gitpod", - "name": "sample-repository", - "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "name": "integration-tests", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests.git", "defaultBranch": "master", "private": false }, - "title": "gitpod/sample-repository - second-branch" + "title": "gitpod/integration-tests - second-branch" }) } @test public async testBranchContext_01() { - const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/sample-repository/branch/master/'); + const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/integration-tests/branch/master/'); expect(result).to.deep.include({ "ref": "master", "refType": "branch", @@ -179,17 +179,17 @@ class TestBitbucketContextParser { "repository": { "host": "bitbucket.org", "owner": "gitpod", - "name": "sample-repository", - "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "name": "integration-tests", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests.git", "defaultBranch": "master", "private": false }, - "title": "gitpod/sample-repository - master" + "title": "gitpod/integration-tests - master" }) } @test public async testBranchContext_02() { - const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/sample-repository/branch/second-branch'); + const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/integration-tests/branch/second-branch'); expect(result).to.deep.include({ "ref": "second-branch", "refType": "branch", @@ -199,17 +199,17 @@ class TestBitbucketContextParser { "repository": { "host": "bitbucket.org", "owner": "gitpod", - "name": "sample-repository", - "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "name": "integration-tests", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests.git", "defaultBranch": "master", "private": false }, - "title": "gitpod/sample-repository - second-branch" + "title": "gitpod/integration-tests - second-branch" }) } @test public async testBranchContext_03() { - const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/sample-repository/branch/feature/JIRA-123-summary'); + const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/integration-tests/branch/feature/JIRA-123-summary'); expect(result).to.deep.include({ "ref": "feature/JIRA-123-summary", "refType": "branch", @@ -219,17 +219,17 @@ class TestBitbucketContextParser { "repository": { "host": "bitbucket.org", "owner": "gitpod", - "name": "sample-repository", - "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "name": "integration-tests", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests.git", "defaultBranch": "master", "private": false }, - "title": "gitpod/sample-repository - feature/JIRA-123-summary" + "title": "gitpod/integration-tests - feature/JIRA-123-summary" }) } @test public async testCommitsContext_02() { - const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/sample-repository/commits/tag/first-tag'); + const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/integration-tests/commits/tag/first-tag'); expect(result).to.deep.include({ "ref": "first-tag", "refType": "tag", @@ -239,17 +239,17 @@ class TestBitbucketContextParser { "repository": { "host": "bitbucket.org", "owner": "gitpod", - "name": "sample-repository", - "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "name": "integration-tests", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests.git", "defaultBranch": "master", "private": false }, - "title": "gitpod/sample-repository - first-tag" + "title": "gitpod/integration-tests - first-tag" }) } @test public async testSrcContext_04() { - const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/sample-repository/src/first-tag/'); + const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/integration-tests/src/first-tag/'); expect(result).to.deep.include({ "ref": "first-tag", "refType": "tag", @@ -259,17 +259,17 @@ class TestBitbucketContextParser { "repository": { "host": "bitbucket.org", "owner": "gitpod", - "name": "sample-repository", - "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "name": "integration-tests", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests.git", "defaultBranch": "master", "private": false }, - "title": "gitpod/sample-repository - first-tag" + "title": "gitpod/integration-tests - first-tag" }) } @test public async testCommitsContext_03() { - const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/sample-repository/commits/5a24a0c8a7b42c2e6418593d788e17cb987bda25'); + const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/integration-tests/commits/5a24a0c8a7b42c2e6418593d788e17cb987bda25'); expect(result).to.deep.include({ "ref": "", "refType": "revision", @@ -279,17 +279,17 @@ class TestBitbucketContextParser { "repository": { "host": "bitbucket.org", "owner": "gitpod", - "name": "sample-repository", - "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "name": "integration-tests", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests.git", "defaultBranch": "master", "private": false }, - "title": "gitpod/sample-repository - 5a24a0c8a7b42c2e6418593d788e17cb987bda25" + "title": "gitpod/integration-tests - 5a24a0c8a7b42c2e6418593d788e17cb987bda25" }) } @test public async testFileContext_01() { - const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/sample-repository/src/master/README.md'); + const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/integration-tests/src/master/README.md'); expect(result).to.deep.include({ "ref": "master", "refType": "branch", @@ -299,17 +299,17 @@ class TestBitbucketContextParser { "repository": { "host": "bitbucket.org", "owner": "gitpod", - "name": "sample-repository", - "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "name": "integration-tests", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests.git", "defaultBranch": "master", "private": false }, - "title": "gitpod/sample-repository - master:README.md" + "title": "gitpod/integration-tests - master:README.md" }) } @test public async testFileContext_02() { - const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/sample-repository/src/branch-with-dir/my-dir/test.txt'); + const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/integration-tests/src/branch-with-dir/my-dir/test.txt'); expect(result).to.deep.include({ "ref": "branch-with-dir", "refType": "branch", @@ -319,17 +319,17 @@ class TestBitbucketContextParser { "repository": { "host": "bitbucket.org", "owner": "gitpod", - "name": "sample-repository", - "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "name": "integration-tests", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests.git", "defaultBranch": "master", "private": false }, - "title": "gitpod/sample-repository - branch-with-dir:my-dir/test.txt" + "title": "gitpod/integration-tests - branch-with-dir:my-dir/test.txt" }) } @test public async testDirectoryContext_01() { - const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/sample-repository/src/branch-with-dir/my-dir/'); + const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/integration-tests/src/branch-with-dir/my-dir/'); expect(result).to.deep.include({ "ref": "branch-with-dir", "refType": "branch", @@ -339,24 +339,24 @@ class TestBitbucketContextParser { "repository": { "host": "bitbucket.org", "owner": "gitpod", - "name": "sample-repository", - "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "name": "integration-tests", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests.git", "defaultBranch": "master", "private": false }, - "title": "gitpod/sample-repository - branch-with-dir:my-dir" + "title": "gitpod/integration-tests - branch-with-dir:my-dir" }) } @test public async testPullRequestContext_01() { - const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/sample-repository/pull-requests/1/readme-updated/diff'); + const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/integration-tests/pull-requests/1/readme-updated/diff'); expect(result).to.deep.include({ "title": "Readme updated", "repository": { "host": "bitbucket.org", "owner": "gitpod", - "name": "sample-repository", - "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "name": "integration-tests", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests.git", "defaultBranch": "master", "private": false, }, @@ -368,8 +368,8 @@ class TestBitbucketContextParser { "repository": { "host": "bitbucket.org", "owner": "gitpod", - "name": "sample-repository", - "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "name": "integration-tests", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests.git", "defaultBranch": "master", "private": false }, @@ -380,22 +380,22 @@ class TestBitbucketContextParser { } @test public async testPullRequestContext_02() { - const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/sample-repository/pull-requests/3/say-hello-to-gitpod/diff'); + const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/integration-tests/pull-requests/3/say-hello-to-gitpod/diff'); expect(result).to.deep.include({ "title": "Say Hello to Gitpod", "repository": { "host": "bitbucket.org", "owner": "corneliusltf", - "name": "sample-repository", - "cloneUrl": "https://bitbucket.org/corneliusltf/sample-repository.git", + "name": "integration-tests", + "cloneUrl": "https://bitbucket.org/corneliusltf/integration-tests.git", "defaultBranch": "master", "private": false, "fork": { "parent": { - "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests.git", "defaultBranch": "master", "host": "bitbucket.org", - "name": "sample-repository", + "name": "integration-tests", "owner": "gitpod", "private": false, } @@ -409,8 +409,8 @@ class TestBitbucketContextParser { "repository": { "host": "bitbucket.org", "owner": "gitpod", - "name": "sample-repository", - "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "name": "integration-tests", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests.git", "defaultBranch": "master", "private": false }, @@ -421,15 +421,15 @@ class TestBitbucketContextParser { } @test public async testIssueContext_01() { - const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/sample-repository/issues/1/first-issue'); + const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/integration-tests/issues/1/first-issue'); expect(result).to.deep.include( { "title": "First issue", "repository": { "host": "bitbucket.org", "owner": "gitpod", - "name": "sample-repository", - "cloneUrl": "https://bitbucket.org/gitpod/sample-repository.git", + "name": "integration-tests", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests.git", "defaultBranch": "master", "private": false }, @@ -473,7 +473,7 @@ class TestBitbucketContextParser { } @test public async testFetchCommitHistory() { - const result = await this.parser.fetchCommitHistory({}, this.user, 'https://bitbucket.org/gitpod/sample-repository', 'dd0aef8097a7c521b8adfced795fcf96c9e598ef', 100); + const result = await this.parser.fetchCommitHistory({}, this.user, 'https://bitbucket.org/gitpod/integration-tests', 'dd0aef8097a7c521b8adfced795fcf96c9e598ef', 100); expect(result).to.deep.equal([ 'da2119f51b0e744cb6b36399f8433b477a4174ef', ]) From 68130a601a6a2372bd61ec1413b773efa19e0de9 Mon Sep 17 00:00:00 2001 From: Geoffrey Huntley Date: Sat, 28 Aug 2021 06:34:02 +0000 Subject: [PATCH 3/6] document how to run integration tests --- components/server/src/bitbucket/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 components/server/src/bitbucket/README.md diff --git a/components/server/src/bitbucket/README.md b/components/server/src/bitbucket/README.md new file mode 100644 index 00000000000000..a27cfba041af01 --- /dev/null +++ b/components/server/src/bitbucket/README.md @@ -0,0 +1,10 @@ +# BitBucket Integration tests + +To run the BitBucket integration tests via `npm test` the `GITPOD_TEST_TOKEN_BITBUCKET` environment variable needs to be defined: + +```bash +export GITPOD_TEST_TOKEN_BITBUCKET='{ value: "$token", scopes: [] }' +``` + +Replace `$token` with the integration test token. + From b94b2658b5ad20ecfd73a9864e2a4abbb6d592e8 Mon Sep 17 00:00:00 2001 From: Geoffrey Huntley Date: Sat, 28 Aug 2021 06:40:16 +0000 Subject: [PATCH 4/6] add hint about test.only --- components/server/src/bitbucket/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/components/server/src/bitbucket/README.md b/components/server/src/bitbucket/README.md index a27cfba041af01..e81492c5f38cdf 100644 --- a/components/server/src/bitbucket/README.md +++ b/components/server/src/bitbucket/README.md @@ -8,3 +8,20 @@ export GITPOD_TEST_TOKEN_BITBUCKET='{ value: "$token", scopes: [] }' Replace `$token` with the integration test token. +## Running a single test + +Use `test.only` thus: + +```js +test('Your cool test', function (done) { + //... +} +``` + +becomes + +```js +test.only('Your cool test', function (done) { + //... +} +``` From d22c5e720786e42452b00440bebbd248d484acf8 Mon Sep 17 00:00:00 2001 From: Geoffrey Huntley Date: Mon, 30 Aug 2021 06:45:38 +0000 Subject: [PATCH 5/6] correct syntax for the test token --- components/server/src/bitbucket/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/server/src/bitbucket/README.md b/components/server/src/bitbucket/README.md index e81492c5f38cdf..70f52762fcd4a0 100644 --- a/components/server/src/bitbucket/README.md +++ b/components/server/src/bitbucket/README.md @@ -3,10 +3,10 @@ To run the BitBucket integration tests via `npm test` the `GITPOD_TEST_TOKEN_BITBUCKET` environment variable needs to be defined: ```bash -export GITPOD_TEST_TOKEN_BITBUCKET='{ value: "$token", scopes: [] }' +export GITPOD_TEST_TOKEN_BITBUCKET='{ "username": "$username", "value": "$applicationPassword", "scopes": [] }' ``` -Replace `$token` with the integration test token. +Replace `$username` / `$applicationPassword` with the integration test username and application password. ## Running a single test From 4b068cdb4480da8059e986711f49c1816c2470d6 Mon Sep 17 00:00:00 2001 From: Geoffrey Huntley Date: Wed, 8 Sep 2021 02:40:47 +0000 Subject: [PATCH 6/6] test scenario passing --- .../bitbucket/bitbucket-context-parser.spec.ts | 16 ++++++++-------- .../src/bitbucket/bitbucket-context-parser.ts | 4 ++-- .../bitbucket/bitbucket-file-provider.spec.ts | 4 ++-- .../bitbucket-language-provider.spec.ts | 2 +- .../bitbucket-repository-provider.spec.ts | 10 +++++----- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/components/server/src/bitbucket/bitbucket-context-parser.spec.ts b/components/server/src/bitbucket/bitbucket-context-parser.spec.ts index 3e6d10057d6b28..9d4ef5ad832ac3 100644 --- a/components/server/src/bitbucket/bitbucket-context-parser.spec.ts +++ b/components/server/src/bitbucket/bitbucket-context-parser.spec.ts @@ -214,7 +214,7 @@ class TestBitbucketContextParser { "ref": "feature/JIRA-123-summary", "refType": "branch", "path": "", - "revision": "5a24a0c8a7b42c2e6418593d788e17cb987bda25", + "revision": "bcf3a4b9329385b7a5f50a4490b79570da029cf3", "isFile": false, "repository": { "host": "bitbucket.org", @@ -386,8 +386,8 @@ class TestBitbucketContextParser { "repository": { "host": "bitbucket.org", "owner": "corneliusltf", - "name": "integration-tests", - "cloneUrl": "https://bitbucket.org/corneliusltf/integration-tests.git", + "name": "sample-repository", + "cloneUrl": "https://bitbucket.org/corneliusltf/sample-repository.git", "defaultBranch": "master", "private": false, "fork": { @@ -443,18 +443,18 @@ class TestBitbucketContextParser { } @test public async testSrcContextForkedRepo_01() { - const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/clu-sample-repo/src/master/'); + const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/integration-tests-forked-repository/src/master/'); expect(result).to.deep.include({ "ref": "master", "refType": "branch", "path": "", - "revision": "d932021835e4024136a4f608719720d414490c73", + "revision": "3f1c8403570427170bd3776cfb3aa24c688c2b29", "isFile": false, "repository": { "host": "bitbucket.org", "owner": "gitpod", - "name": "clu-sample-repo", - "cloneUrl": "https://bitbucket.org/gitpod/clu-sample-repo.git", + "name": "integration-tests-forked-repository", + "cloneUrl": "https://bitbucket.org/gitpod/integration-tests-forked-repository.git", "defaultBranch": "master", "private": false, "fork": { @@ -468,7 +468,7 @@ class TestBitbucketContextParser { } } }, - "title": "gitpod/clu-sample-repo - master" + "title": "gitpod/integration-tests-forked-repository - master" }) } diff --git a/components/server/src/bitbucket/bitbucket-context-parser.ts b/components/server/src/bitbucket/bitbucket-context-parser.ts index 24d35c9f17e061..876e6b8ebdb0e1 100644 --- a/components/server/src/bitbucket/bitbucket-context-parser.ts +++ b/components/server/src/bitbucket/bitbucket-context-parser.ts @@ -58,8 +58,8 @@ export class BitbucketContextParser extends AbstractContextParser implements ICo } case "branch": { const more: Partial = {}; - const branch = moreSegments.length > 1 ? moreSegments[1] : ""; - more.ref = branch; + const pathSegments = moreSegments.length > 1 ? moreSegments.slice(1) : []; + more.ref = pathSegments.join("/"); more.refType = "branch"; return this.handleNavigatorContext(ctx, user, host, owner, repoName, more); } diff --git a/components/server/src/bitbucket/bitbucket-file-provider.spec.ts b/components/server/src/bitbucket/bitbucket-file-provider.spec.ts index 4000e2c22198f4..b2c61276274cb1 100644 --- a/components/server/src/bitbucket/bitbucket-file-provider.spec.ts +++ b/components/server/src/bitbucket/bitbucket-file-provider.spec.ts @@ -61,14 +61,14 @@ class TestBitbucketFileProvider { } @test public async testGetFileContents() { - const result = await this.fileProvider.getFileContent({ repository: { owner: "gitpod", name: "sample-repository" }, revision: "5a24a0c" } as Commit, this.user, "README.md"); + const result = await this.fileProvider.getFileContent({ repository: { owner: "gitpod", name: "integration-tests" }, revision: "5a24a0c" } as Commit, this.user, "README.md"); expect(result).to.equal(`# README # This is the readme of the second branch.`); } @test public async testGetLastChangeRevision() { - const result = await this.fileProvider.getLastChangeRevision({ owner: "gitpod", name: "sample-repository" } as Repository, "second-branch", this.user, "README.md"); + const result = await this.fileProvider.getLastChangeRevision({ owner: "gitpod", name: "integration-tests" } as Repository, "second-branch", this.user, "README.md"); expect(result).to.equal("5a24a0c8a7b42c2e6418593d788e17cb987bda25"); } } diff --git a/components/server/src/bitbucket/bitbucket-language-provider.spec.ts b/components/server/src/bitbucket/bitbucket-language-provider.spec.ts index a183c340f8ffa0..749a41822d52c7 100644 --- a/components/server/src/bitbucket/bitbucket-language-provider.spec.ts +++ b/components/server/src/bitbucket/bitbucket-language-provider.spec.ts @@ -61,7 +61,7 @@ class TestBitbucketLanguageProvider { } @test public async testGetLanguages() { - const result = await this.languageProvider.getLanguages({ owner: "gitpod", name: "sample-repository" } as Repository, this.user); + const result = await this.languageProvider.getLanguages({ owner: "gitpod", name: "integration-tests" } as Repository, this.user); expect(result).to.deep.equal({ "markdown": 100.0 }); } diff --git a/components/server/src/bitbucket/bitbucket-repository-provider.spec.ts b/components/server/src/bitbucket/bitbucket-repository-provider.spec.ts index cdcdb36302ee68..89fa8a32ce353f 100644 --- a/components/server/src/bitbucket/bitbucket-repository-provider.spec.ts +++ b/components/server/src/bitbucket/bitbucket-repository-provider.spec.ts @@ -61,14 +61,14 @@ class TestBitbucketRepositoryProvider { } @test public async testGetRepo() { - const result = await this.repoProvider.getRepo(this.user, "gitpod", "sample-repository"); + const result = await this.repoProvider.getRepo(this.user, "gitpod", "integration-tests"); expect(result).to.deep.include({ host: "bitbucket.org", owner: "gitpod", - name: "sample-repository", - cloneUrl: "https://gitpod@bitbucket.org/gitpod/sample-repository.git", - description: "This is a sample repository.", - webUrl: "https://bitbucket.org/gitpod/sample-repository", + name: "integration-tests", + cloneUrl: "https://gitpod-test@bitbucket.org/gitpod/integration-tests.git", + description: "This is the repository used for integration tests.", + webUrl: "https://bitbucket.org/gitpod/integration-tests", }); }