-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
services: migrate external tap to main repo (WIP) #19385
base: master
Are you sure you want to change the base?
Conversation
Can try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, great work so far @botantony! Thanks for this.
@@ -1,13 +1,12 @@ | |||
# frozen_string_literal: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to also move some of https://github.com/Homebrew/homebrew-services/tree/master/spec into Library/Homebrew/test
too for some basic unit testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested some specs and it is probably easier to just write them from scratch. homebrew-services repo doesn't use strict types and as the result they "emulate" formula object with OpenStruct. I'll try to write new unit tests that test functions the proper way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@botantony It's ok to not use strict types here and even maintain the emulation for now. The goal is to have this merged with the code as close as possible to that in homebrew-services. Additional refactoring should be in a follow-up PR. Thanks 🙇🏻
Thanks for taking this on @botantony! Have loved seeing all of your great contributions lately! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good @botantony! Think once the specs get ported over as as-is as possible: this should be good to merge!
does anyone have an idea why this test may fail? describe "#dest" do
it "macOS - outputs the destination for the service file" do
ENV["HOME"] = "/tmp_home"
allow(Service::System).to receive_messages(launchctl?: true, systemctl?: false)
expect(service.dest.to_s).to eq("/tmp_home/Library/LaunchAgents/homebrew.mysql.plist")
end
it "systemD - outputs the destination for the service file" do
ENV["HOME"] = "/tmp_home"
allow(Service::System).to receive_messages(launchctl?: false, systemctl?: true)
expect(service.dest.to_s).to eq("/tmp_home/.config/systemd/user/homebrew.mysql.service")
end
end shell output:
it tests formula_wrapper.rb |
@botantony My best guess is something was being mocked successfully before but is not being mocked in the test now? |
Oh, I found the issue, there's no need to set values in |
ee2870d
to
91bb00b
Compare
The tap tests redefines So you'll need to separate that output to check the root message under stderr and the success message under stdout .to output(...).to_stdout
.and output(...).to_stderr |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?Any feedback/suggestion is appreciated (
help wanted
label would be nice). For some reason I cannot generate.rbi
file for dynamic methods:Maybe I'm doing something wrong
partially resolves #19210