Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

HARP-12989 Fix extra console entries in tests #1972

Merged
merged 6 commits into from
Nov 19, 2020
Merged

HARP-12989 Fix extra console entries in tests #1972

merged 6 commits into from
Nov 19, 2020

Conversation

nzjony
Copy link
Member

@nzjony nzjony commented Nov 16, 2020

No description provided.

Signed-off-by: Jonathan Stichbury <2533428+nzjony@users.noreply.github.com>
private readonly m_backgroundDataSource?: BackgroundDataSource;

constructor(private readonly m_mapView: MapView, options: MapViewEnvironmentOptions) {
this.m_fog = new MapViewFog(this.m_mapView.scene);
if (options.addBackgroundDatasource !== false) {
this.m_backgroundDataSource = new BackgroundDataSource();
this.m_mapView.addDataSource(this.m_backgroundDataSource);
this.m_backgroundDSPromise = this.m_mapView.addDataSource(this.m_backgroundDataSource);
Copy link
Member Author

Choose a reason for hiding this comment

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

We need to capture this and make it external so that it can be awaited in the test to ensure that it is connected before we continue test execution.

@@ -77,6 +77,10 @@ export class MapViewTaskScheduler extends THREE.EventDispatcher {
let numItemsLeft = this.taskQueue.numItemsLeft();
currentFrameEvent?.setValue("TaskScheduler.numPendingTasks", numItemsLeft);

// Needed for tests that dispose but that still have running tasks after MapView disposed.
Copy link
Member Author

Choose a reason for hiding this comment

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

Otherwise the tasks are executed on a mapView that has disposed and the update method sends long of messages to the console.

@nzjony
Copy link
Member Author

nzjony commented Nov 16, 2020

retest this please

Signed-off-by: Jonathan Stichbury <2533428+nzjony@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Nov 16, 2020

Codecov Report

Merging #1972 (ecd16a6) into master (7824047) will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1972      +/-   ##
==========================================
+ Coverage   65.89%   65.97%   +0.07%     
==========================================
  Files         293      293              
  Lines       26238    26257      +19     
  Branches     5945     5947       +2     
==========================================
+ Hits        17290    17323      +33     
+ Misses       8948     8934      -14     
Impacted Files Coverage Δ
@here/harp-mapview/lib/MapView.ts 73.42% <100.00%> (+0.67%) ⬆️
@here/harp-mapview/lib/MapViewTaskScheduler.ts 52.30% <100.00%> (+1.51%) ⬆️
@here/harp-test-utils/lib/TestUtils.ts 83.47% <100.00%> (+2.16%) ⬆️
@here/harp-utils/lib/TaskQueue.ts 84.61% <100.00%> (+0.48%) ⬆️
@here/harp-utils/lib/Logger/ConsoleChannel.ts 7.69% <0.00%> (-61.54%) ⬇️
...here/harp-mapview/lib/text/TextElementsRenderer.ts 71.03% <0.00%> (+0.47%) ⬆️
@here/harp-utils/lib/Logger/LoggerManagerImpl.ts 85.10% <0.00%> (+4.25%) ⬆️
@here/harp-mapview/lib/CameraMovementDetector.ts 92.95% <0.00%> (+11.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7824047...ecd16a6. Read the comment docs.

Signed-off-by: Jonathan Stichbury <2533428+nzjony@users.noreply.github.com>
Signed-off-by: Jonathan Stichbury <2533428+nzjony@users.noreply.github.com>
@nzjony
Copy link
Member Author

nzjony commented Nov 17, 2020

@atomicsulfate , thanks for the review, I have resolved them.

Comment on lines 78 to 86
/**
* Required to be able to wait for this DataSource to be added, if not, the MapViewTest.ts will
* complain because we then call update() once the MapView is disposed.
* @internal
*/
get backgroundDataSourcePromise(): Promise<void> | undefined {
return this.m_backgroundDSPromise;
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can and should avoid exposing this implementation detail, see my comments in MapViewTest.

@@ -1434,6 +1453,8 @@ describe("MapView", function() {
};
}
mapView = new MapView({ canvas, theme: {} });
await mapView.getTheme();
await mapView.sceneEnvironment.backgroundDataSourcePromise;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not needed, I checked locally and only waiting for the theme it's enough to get rid of the errors.

Copy link
Member Author

@nzjony nzjony Nov 17, 2020

Choose a reason for hiding this comment

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

I will recheck, because I tried this too and got an error.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was wrong, have fixed.

Copy link
Collaborator

@atomicsulfate atomicsulfate left a comment

Choose a reason for hiding this comment

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

There's many more tests in MapViewTest that trigger an update after disposal of the MapView (e.g. all those called "Correctly sets..."). I checked some and they're fixed just by waiting for the theme after the MapView construction.

Signed-off-by: Jonathan Stichbury <2533428+nzjony@users.noreply.github.com>
@nzjony
Copy link
Member Author

nzjony commented Nov 18, 2020

There's many more tests in MapViewTest that trigger an update after disposal of the MapView (e.g. all those called "Correctly sets..."). I checked some and they're fixed just by waiting for the theme after the MapView construction.

I don't see any cases of this with my latest change set... can you try again with my latest changes please?

Copy link
Collaborator

@atomicsulfate atomicsulfate left a comment

Choose a reason for hiding this comment

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

There's many more tests in MapViewTest that trigger an update after disposal of the MapView (e.g. all those called "Correctly sets..."). I checked some and they're fixed just by waiting for the theme after the MapView construction.

I don't see any cases of this with my latest change set... can you try again with my latest changes please?

You can see them in Travis for your build:
https://travis-ci.com/github/heremaps/harp.gl/jobs/442111620#L7504
https://travis-ci.com/github/heremaps/harp.gl/jobs/442111620#L4235

Signed-off-by: Jonathan Stichbury <2533428+nzjony@users.noreply.github.com>
@nzjony
Copy link
Member Author

nzjony commented Nov 18, 2020

There's many more tests in MapViewTest that trigger an update after disposal of the MapView (e.g. all those called "Correctly sets..."). I checked some and they're fixed just by waiting for the theme after the MapView construction.

I don't see any cases of this with my latest change set... can you try again with my latest changes please?

You can see them in Travis for your build:
https://travis-ci.com/github/heremaps/harp.gl/jobs/442111620#L7504
https://travis-ci.com/github/heremaps/harp.gl/jobs/442111620#L4235

Thanks, weird, I couldn't reproduce them locally, I guess because I use a different node version. I have pushed a fix and will check the travis-ci.

@nzjony
Copy link
Member Author

nzjony commented Nov 19, 2020

retest this please

@nzjony nzjony merged commit 5fd6d51 into master Nov 19, 2020
@nzjony nzjony deleted the HARP-12989 branch November 19, 2020 09:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants