Skip to content
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

Fix CI Dashboard unit testing #2984

Merged

Conversation

webbnh
Copy link
Member

@webbnh webbnh commented Aug 25, 2022

This PR addresses some of the issues that we've seen recently with the Dashboard unit testing in the CI.

In particular, the unit tests were failing with

    Cookie has domain set to the public suffix "localhost" which is a special use domain. To allow this, configure your CookieJar with {allowSpecialUseDomain:true, rejectPublicSuffixes: false}.

      at Object.getPublicSuffix (node_modules/tough-cookie/lib/pubsuffix-psl.js:62:11)
      at permuteDomain (node_modules/tough-cookie/lib/permuteDomain.js:38:28)
      at MemoryCookieStore.findCookies (node_modules/tough-cookie/lib/memstore.js:99:21)
      at MemoryCookieStore.findCookies (node_modules/universalify/index.js:5:67)
      at CookieJar.getCookies (node_modules/tough-cookie/lib/cookie.js:1407:11)
      at CookieJar.getCookies (node_modules/universalify/index.js:5:67)
      at CookieJar.getCookieString (node_modules/tough-cookie/lib/cookie.js:1452:21)
      at CookieJar.getCookieString (node_modules/universalify/index.js:5:67)
      at CookieJar.getCookieStringSync (node_modules/tough-cookie/lib/cookie.js:1723:21)
      at DocumentImpl.get cookie [as cookie] (node_modules/jsdom/lib/jsdom/living/nodes/Document-impl.js:860:28)

which was the result of a breaking change to the tough-cookie component. tough-cookie is not used by the Dashboard; rather, it's a dependency of a dependency of Jest which we use for Dashboard unit testing.

This PR makes three changes:

  • Add an explicit (development) dependency on tough-cookie v4.1.2 (the breakage was introduced in v4.1.0, and v4.1.1 was a failed attempt to fix it); without the explicit dependency, we seem to still pick up v4.1.0.
  • Add a command to the build script to remove the node_modules directory, to ensure that we pick up a fresh installation of our dependencies. (There are other ways to accomplish this (such as the npm commands, clean-install and ci), but without a version-controlled package-lock.json file, they all present problems, so we'll just brute-force it for now.) Also, since it's not currently version-controlled, remove the package-lock.json file, so that we generate a fresh set of dependencies on each build.
  • Remove the dependency on nvm. It pulls a very old version of the manager, and we don't seem to actually need it (at least, as a production dependency...).

@webbnh webbnh added Code Infrastructure Dashboard Of and relating to the Dashboard GUI labels Aug 25, 2022
@webbnh webbnh self-assigned this Aug 25, 2022
@portante portante added this to In progress in v0.72 via automation Aug 26, 2022
@portante portante added this to the v0.72 milestone Aug 26, 2022
Copy link
Member

@dbutenhof dbutenhof left a comment

Choose a reason for hiding this comment

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

Someone created, and someone else used, a package called "tough-cookie". (Sigh.)

v0.72 automation moved this from In progress to Reviewer approved Aug 26, 2022
@dbutenhof
Copy link
Member

Oh, and... we really ought to be tracking all our work with Jira issues.

@dbutenhof dbutenhof merged commit 519d69f into distributed-system-analysis:main Aug 26, 2022
v0.72 automation moved this from Reviewer approved to Done Aug 26, 2022
@webbnh webbnh deleted the fix-ci-dashboard-unit-test branch August 26, 2022 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Infrastructure Dashboard Of and relating to the Dashboard GUI
Projects
v0.72
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants