Skip to content

Commit

Permalink
Support SAS URL in test apps (#7355)
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Connelly <[email protected]>
  • Loading branch information
mathieu-lemuzic and pmconne authored Nov 13, 2024
1 parent 7749869 commit d8b4364
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,18 @@ export class DisplayPerfTestApp {
urlStr = urlStr.replace("{iModel.filename}", getFileName(runner.curConfig.iModelName));
urlStr = urlStr.replace("{iModel.extension}", getFileExt(runner.curConfig.iModelName));
const url = new URL(urlStr);
const tilesetUrl = new URL("tileset.json", url);
tilesetUrl.search = url.search;

// Check if a tileset has been published for this iModel.
try {
// See if a tileset has been published for this iModel.
const response = await fetch(`${url}tileset.json`);
console.log(`Checking for tileset at ${tilesetUrl.toString()}`); // eslint-disable-line no-console
const response = await fetch(tilesetUrl);
await response.json();
runner.curConfig.urlStr = urlStr;
return url;
} catch {
runner.curConfig.urlStr = `${urlStr}tileset.json - Not found`;
runner.curConfig.urlStr = `${tilesetUrl.toString()} - Not found`;
// No tileset available.
return undefined;
}
Expand Down
8 changes: 6 additions & 2 deletions test-apps/display-test-app/src/frontend/DisplayTestApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,13 @@ const dtaFrontendMain = async () => {
urlStr = urlStr.replace("{iModel.filename}", getFileName(iModel.key));
urlStr = urlStr.replace("{iModel.extension}", getFileExt(iModel.key));
const url = new URL(urlStr);
const tilesetUrl = new URL("tileset.json", url);
tilesetUrl.search = url.search;

// Check if a tileset has been published for this iModel.
try {
// See if a tileset has been published for this iModel.
const response = await fetch(`${url}tileset.json`);
console.log(`Checking for tileset at ${tilesetUrl.toString()}`); // eslint-disable-line no-console
const response = await fetch(tilesetUrl);
await response.json();
return url;
} catch {
Expand Down

0 comments on commit d8b4364

Please sign in to comment.