Skip to content

test(docs-infra): fix double-slash in URL of aio_monitoring test - #25641

Closed
gkalpak wants to merge 1 commit into
angular:masterfrom
gkalpak:fix-docs-infra-aio_monitoring-CI-job
Closed

gkalpak wants to merge 1 commit into
angular:masterfrom
gkalpak:fix-docs-infra-aio_monitoring-CI-job

Conversation

@gkalpak

@gkalpak gkalpak commented Aug 23, 2018

Copy link
Copy Markdown
Member

As part of the tests run in the CircleCI aio_monitoring job, we need to retrieve sitemap.xml from the site under test. Previously, the URL used to retrieve that contained a double-slash (//). At some point,
Firebase (which is used for hosting the site) stopped normalizing double-slashes to a single slash, causing the test to fail.

This commit fixes the problem by ensuring that the constructed URLs do not contain double-slashes.

@gkalpak gkalpak added action: review The PR is still awaiting reviews from at least one requested reviewer comp: docs-infra target: patch This PR is targeted for the next patch release labels Aug 23, 2018
@mary-poppins

Copy link
Copy Markdown

You can preview 51483b7 at https://pr25641-51483b7.ngbuilds.io/.

As part of the tests run in the CircleCI `aio_monitoring` job, we need
to retrieve `sitemap.xml` from the site under test. Previously, the URL
used to retrieve that contained a double-slash (`//`). At some point,
Firebase (which is used for hosting the site) stopped normalizing
double-slashes to a single slash, causing the test to fail.

This commit fixes the problem by ensuring that the constructed URLs do
not contain double-slashes.
@gkalpak
gkalpak force-pushed the fix-docs-infra-aio_monitoring-CI-job branch from 51483b7 to 267c60e Compare August 28, 2018 10:37
@mary-poppins

Copy link
Copy Markdown

You can preview 267c60e at https://pr25641-267c60e.ngbuilds.io/.

@petebacondarwin

Copy link
Copy Markdown
Contributor

Where do the notifications that this monitoring task are failing go?

@petebacondarwin petebacondarwin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if use of canonical-path.join and/or url.resolve would simplify a lot of this?

}

export async function loadRemoteSitemapUrls(host: string) {
host = host.replace(/\/$/, '');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could just use path.join(host, 'generated/sitemap.xml') on the following line instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.then(cb);

await browser.get(url || browser.baseUrl);
await browser.get(url || this.baseUrl);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So accessing the browser.baseUrl when it ends in a forward slash errors?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, but I want to be consistent 😁

await page.goTo(url);

const expectedUrl = prependBaseUrl(url);
const expectedUrl = stripTrailingSlash(page.baseUrl + url);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we not use path.join(page.baseUrl, url) here? That would prevent double slashes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if we used canonical-path (to avoid http:\\foo\bar), path.join() would normalize http://foo to http:/foo 😁

@gkalpak

gkalpak commented Sep 5, 2018

Copy link
Copy Markdown
Member Author

Where do the notifications that this monitoring task are failing go?

@kara mentioned the caretaker gets them (in some form).

I wonder if use of canonical-path.join and/or url.resolve would simplify a lot of this?

B...but...this is already pretty simple 😛
Seriously, canonical-path.join and url.resolve have their own issues. For example, canonical-path.join normalizes double-slashes we don't want normalized (http://foo --> http:/foo) and url.resolve does not necessarily join paths (http://foo/bar + /baz/qux --> http://foo/baz/qux (instead of http://foo/bar/baz/qux)).

@petebacondarwin petebacondarwin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK OK - as long as it works :-)

@gkalpak gkalpak added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Sep 5, 2018
@mhevery

mhevery commented Sep 5, 2018

Copy link
Copy Markdown
Contributor

This merges cleanly to master, but not to patch. Can you create a separate PR for the patch.

@mhevery mhevery added target: major This PR is targeted for the next major release and removed target: patch This PR is targeted for the next patch release labels Sep 5, 2018
@mhevery mhevery closed this in 13b8399 Sep 5, 2018
@gkalpak
gkalpak deleted the fix-docs-infra-aio_monitoring-CI-job branch September 5, 2018 18:41
@gkalpak

gkalpak commented Sep 5, 2018

Copy link
Copy Markdown
Member Author

Backported as #25820.

gkalpak added a commit to gkalpak/angular that referenced this pull request Sep 6, 2018
…ngular#25641)

As part of the tests run in the CircleCI `aio_monitoring` job, we need
to retrieve `sitemap.xml` from the site under test. Previously, the URL
used to retrieve that contained a double-slash (`//`). At some point,
Firebase (which is used for hosting the site) stopped normalizing
double-slashes to a single slash, causing the test to fail.

This commit fixes the problem by ensuring that the constructed URLs do
not contain double-slashes.

PR Close angular#25641
IgorMinar pushed a commit that referenced this pull request Sep 6, 2018
…25641) (#25820)

As part of the tests run in the CircleCI `aio_monitoring` job, we need
to retrieve `sitemap.xml` from the site under test. Previously, the URL
used to retrieve that contained a double-slash (`//`). At some point,
Firebase (which is used for hosting the site) stopped normalizing
double-slashes to a single slash, causing the test to fail.

This commit fixes the problem by ensuring that the constructed URLs do
not contain double-slashes.

PR Close #25641

PR Close #25820
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Sep 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants