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

Switch from CliWrap to Shellfish #1046

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Switch from CliWrap to Shellfish #1046

wants to merge 3 commits into from

Conversation

borland
Copy link
Contributor

@borland borland commented Nov 28, 2024

Background

Tentacle uses CliWrap for a handful of tests because it supports async execution.

our own Shellfish library has been recently enhanced to support this too.

Results

In the interests of dogfooding our own code, let's use Shellfish instead of CliWrap in the tentacle tests.

How to review this PR

Quality ✔️

Just a few changes to tests. If the tests pass, we should be good

Pre-requisites

  • I have read How we use GitHub Issues for help deciding when and where it's appropriate to make an issue.
  • I have considered informing or consulting the right people, according to the ownership map.
  • I have considered appropriate testing for my change.

@borland borland marked this pull request as ready for review November 28, 2024 01:14
@borland borland requested a review from a team as a code owner November 28, 2024 01:14
@@ -119,7 +118,7 @@ public async Task VersionCommandTextFormat(TentacleConfigurationTestCase tc)

var expectedVersion = GetVersionInfo(tc);

stdout.Should().Be(expectedVersion.ProductVersion, "The version command should print the informational version as text");
stdout.TrimEnd().Should().Be(expectedVersion.ProductVersion, "The version command should print the informational version as text");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

CliWrap deals with text output in a slightly different way to Shellfish.

If the app emits text without a trailing newline, CliWrap wouldn't give you a trailing newline either, whereas with Shellfish we get a trailing newline.

This isn't an inherent flaw in Shellfish, but rather just a side effect WithStdOutTarget(stringBuilder) output mechanism. The stringbuilder-writer puts a newline on the end of everything to keep things simple. We could do WithStdOutTarget(someCustomTarget) and get the output in a more direct way, but that would be harder and more complex than simply trimming the newlines in a few places

Copy link
Contributor

Choose a reason for hiding this comment

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

For the test I don't think it matters.

@LukeButters
Copy link
Contributor

LukeButters commented Nov 28, 2024

No doubt the build has to actually work reliably before merging ;p

@borland
Copy link
Contributor Author

borland commented Nov 28, 2024

No doube the build has to actually work reliably before merging ;p

Yeah I don't know what happened there, the tests just stalled forever on Win10 LTSC with no kind of log or anything, but they worked fine all the other OSes. Not a single test ran... I don't think it had anything to do with the Shellfish change, I'm re-running

@LukeButters
Copy link
Contributor

LukeButters commented Nov 28, 2024

I guess I should comment about the context of this change.

We used to use silent process runner but it being non async meant we ran out of threads which caused hangs, switching to CLIWrap fixed that.

Now that silent process runner is async, the tests here seems like a good place to use that to verify it works well before we use it within Octopus or other related components.

I think this PR makes sense, and I very much agree with the dogfooding approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants