Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented Aug 23, 2018

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

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

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

@petebacondarwin
Copy link
Contributor

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

Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

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?

@@ -49,6 +49,7 @@ export function loadLocalSitemapUrls() {
}

export async function loadRemoteSitemapUrls(host: string) {
host = host.replace(/\/$/, '');
Copy link
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
Member Author

Choose a reason for hiding this comment

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

@@ -44,7 +47,7 @@ export class SitePage {
.then(regs => Promise.all(regs.map(reg => reg.unregister())))
.then(cb);

await browser.get(url || browser.baseUrl);
await browser.get(url || this.baseUrl);
Copy link
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
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 😁

@@ -16,7 +17,7 @@ describe(browser.baseUrl, () => {
it(`should not redirect '${url}' (${i + 1}/${page.sitemapUrls.length})`, async () => {
await page.goTo(url);

const expectedUrl = prependBaseUrl(url);
const expectedUrl = stripTrailingSlash(page.baseUrl + url);
Copy link
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
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
Copy link
Member Author

gkalpak commented Sep 5, 2018

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)).

Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

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
Copy link
Contributor

mhevery commented Sep 5, 2018

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 added a commit to gkalpak/angular that referenced this pull request Sep 5, 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
@gkalpak
Copy link
Member Author

gkalpak commented Sep 5, 2018

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
FrederikSchlemmer pushed a commit to FrederikSchlemmer/angular that referenced this pull request Jan 3, 2019
…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
@angular-automatic-lock-bot
Copy link

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