Skip to content

Add more comprehensive tests#521

Merged
christianbundy merged 35 commits intofraction:masterfrom
christianbundy:add-more-tests
Nov 25, 2020
Merged

Add more comprehensive tests#521
christianbundy merged 35 commits intofraction:masterfrom
christianbundy:add-more-tests

Conversation

@christianbundy
Copy link
Member

Problem: I've been worried about merging these version bump pull
requests since we don't have many tests, and I really don't want to
merge any catostrophic breaking changes anywhere.

Solution: Add some tests that are more comprehensive, starting by
creating a temporary SSB database and keypair and then editing the
profile, previewing a message, publishing a message, etc., until we have
a handful of small functions actually being tested. This won't ensure
that everything works forever, and it really doesn't test replication,
but it should help increase our confidence that test success means that
fewer things are broken.

dependabot bot and others added 22 commits November 22, 2020 20:22
Bumps [ssb-room](https://github.com/staltz/ssb-room) from 1.2.2 to 1.3.0.
- [Release notes](https://github.com/staltz/ssb-room/releases)
- [Commits](staltz/ssb-room@v1.2.2...1.3.0)

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [ssb-query](https://github.com/dominictarr/ssb-query) from 2.4.3 to 2.4.5.
- [Release notes](https://github.com/dominictarr/ssb-query/releases)
- [Commits](ssbc/ssb-query@v2.4.3...v2.4.5)

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [ssb-ooo](https://github.com/dominictarr/ssb-ooo) from 1.3.2 to 1.3.3.
- [Release notes](https://github.com/dominictarr/ssb-ooo/releases)
- [Commits](https://github.com/dominictarr/ssb-ooo/commits)

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [ssb-blobs](https://github.com/ssbc/ssb-blobs) from 1.2.2 to 1.2.3.
- [Release notes](https://github.com/ssbc/ssb-blobs/releases)
- [Commits](https://github.com/ssbc/ssb-blobs/commits/v1.2.3)

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [ssb-invite](https://github.com/ssbc/ssb-invite) from 2.1.4 to 2.1.6.
- [Release notes](https://github.com/ssbc/ssb-invite/releases)
- [Commits](https://github.com/ssbc/ssb-invite/commits/v2.1.6)

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [ssb-meme](https://github.com/ssbc/ssb-meme) from 1.0.4 to 1.1.0.
- [Release notes](https://github.com/ssbc/ssb-meme/releases)
- [Commits](ssbc/ssb-meme@v1.0.4...v1.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [ssb-conn](https://github.com/staltz/ssb-conn) from 0.17.0 to 0.19.1.
- [Release notes](https://github.com/staltz/ssb-conn/releases)
- [Commits](ssbc/ssb-conn@v0.17.0...v0.19.1)

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [ssb-friends](https://github.com/ssbc/ssb-friends) from 4.1.4 to 4.3.0.
- [Release notes](https://github.com/ssbc/ssb-friends/releases)
- [Commits](ssbc/ssb-friends@v4.1.4...v4.3.0)

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [ssb-search](https://github.com/ssbc/ssb-search) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/ssbc/ssb-search/releases)
- [Commits](ssbc/ssb-search@v1.2.1...v1.3.0)

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [ssb-backlinks](https://github.com/ssbc/ssb-backlinks) from 1.0.0 to 2.1.1.
- [Release notes](https://github.com/ssbc/ssb-backlinks/releases)
- [Commits](https://github.com/ssbc/ssb-backlinks/commits/v2.1.1)

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [ssb-db](https://github.com/ssbc/ssb-db) from 19.4.0 to 20.3.0.
- [Release notes](https://github.com/ssbc/ssb-db/releases)
- [Commits](ssbc/ssb-db@v19.4.0...v20.3.0)

Signed-off-by: dependabot[bot] <support@github.com>
Problem: I've been worried about merging these version bump pull
requests since we don't have many tests, and I *really* don't want to
merge any catostrophic breaking changes anywhere.

Solution: Add some tests that are more comprehensive, starting by
creating a temporary SSB database and keypair and then editing the
profile, previewing a message, publishing a message, etc., until we have
a handful of small functions actually being tested. This won't ensure
that everything works forever, and it *really* doesn't test replication,
but it should help increase our confidence that test success means that
fewer things are broken.
@christianbundy
Copy link
Member Author

@black-puppydog for your pleasure I've pulled all of the dep PRs into this one, for a few reasons:

  • ensure that they all work with manual testing
  • ensure that they all pass these new tests together
  • ensure that you remain sane, as far as I'm able to ❤️

Problem: Our tests seem to have been disabled in various places, which
means that type errors, typos, and other small problems were introduced.

Solution: Remove the comments and fix the underlying problems without
disabling the linters.
@black-puppydog
Copy link
Collaborator

oh man, don't worry about my convenience. I was just amused by the timing of it :P

@christianbundy
Copy link
Member Author

I think this one is good to go now!

@christianbundy christianbundy mentioned this pull request Nov 23, 2020
@black-puppydog
Copy link
Collaborator

So, I built this and it runs. But my brain is too tired rn to really grok this. From what I see there, you do handle tests in the env, and don't just post willy-nilly into whatever ssb feed is handled on the machine already 👍. but... how does this work if I'm running e.g. patchwork? I'll have to stop that, right?

It's 2am here... I'm going to bed. 😛

)
: connect({ remote });

originalConnect
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the bit meant to keep it from connecting to Patchwork/etc -- usually it does:

  • try connection to existing server
    • success: keep the connection
    • fail: make a new one
      • success: connect to it
      • fail: crash the server

This change automatically fails the "try connection to existing server" step during tests, which means that it tries to make a new server. If it can make a new server then we know that Patchwork/etc aren't running on that port, and we can run the tests. If it can't make a new server, then Patchwork is probably running and we want to crash loudly.

@christianbundy
Copy link
Member Author

Added a comment to explain that, but go to bed! Talk to you tomorrow dude.

christianbundy and others added 5 commits November 22, 2020 18:02
Problem: With the new ssb-db@20 we have to explicitly add ssb-private1
to ensure that we can see private messages.

Solution: Add ssb-private1 as a plugin.
Bumps [husky](https://github.com/typicode/husky) from 3.1.0 to 4.3.0.
- [Release notes](https://github.com/typicode/husky/releases)
- [Commits](typicode/husky@v3.1.0...v4.3.0)

Signed-off-by: dependabot[bot] <support@github.com>
@cryptix
Copy link
Contributor

cryptix commented Nov 23, 2020

In case you ever want to test against actual feed content, ssb-fixtures might be of interest. Staltz made it for performance benchmarks but a smaller dataset of say, 15 feeds and a couple hundred messages would also make for good test content.

@christianbundy
Copy link
Member Author

That's a great idea @cryptix, thanks! Are there any tests that come to mind? I can imagine the fixtures being useful for a human browsing around, because you can tell when stuff "looks right", but I [pre-coffee] can't think of tests that I'd be able to write with them. Clarification: I'm sure there are tests to write with them, I just need help knowing what to test. 😆

@cryptix
Copy link
Contributor

cryptix commented Nov 23, 2020

Hmmm... Your decision how wild to go with this but I'd use the fixtures to actually check that a thread is rendered (parse the generated html and use css selectors to check the content. In python there is beautifulsoup for this. I must believe npm has something similar)

Another thing that was a bit daunting in the blobs/preview work was testing that a reply actually ends up on a thread still. This could be done on an empty db but fixtures gives you a nice starting ground.

Other areas that come to mind /profile and its about information, nested threads, all the pagination, mentions, votes/popular. basically all the hairy bits of the models that you currently have to test against your live data/installation.

@christianbundy
Copy link
Member Author

Oh, are the fixtures static? If so, that'd be easy to say "make sure that thread X has 10 comments, including this text". I'll poke at it the next time I've got some time. 🚀

Any thoughts on this PR? I'm excited to get the dep PRs merged and then release the new version of Oasis.

@christianbundy
Copy link
Member Author

(Trying to close all the dependency PRs in this branch. 🙏 )

@cryptix
Copy link
Contributor

cryptix commented Nov 24, 2020

Oh, are the fixtures static?

Yup. The repo contains a generated that should be deterministic but you also don’t need to run it again once you are fine with it, I think.

I’m not sure it contains nested replies but those could be created by oasis itself.

@christianbundy
Copy link
Member Author

Been a couple days so I'm going to self-merge.

@christianbundy christianbundy merged commit 50fa52f into fraction:master Nov 25, 2020
@black-puppydog
Copy link
Collaborator

sorry @christianbundy for dropping out here. been a crazy worky week so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants