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

[Review] Request from 'schubi2' @ 'yast/yast-inetd/review_140929_checking_nil' #11

Closed
wants to merge 8 commits into from

Conversation

schubi2
Copy link
Member

@schubi2 schubi2 commented Sep 29, 2014

Please review the following changes:

@@ -1,4 +1,11 @@
-------------------------------------------------------------------
Mon Sep 29 10:51:23 CEST 2014 - schubi@suse.de

- Checking nil server in GetServerBasename.
Copy link
Member

Choose a reason for hiding this comment

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

REQ: The changelog entry is IMO not understandable

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, you are right.

@kobliha
Copy link
Member

kobliha commented Sep 29, 2014

@schubi2
Copy link
Member Author

schubi2 commented Sep 29, 2014

I have added a test case.

result = server_args.dup if server_args
else
result = server.dup if server
end
Copy link
Member

Choose a reason for hiding this comment

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

NP: well, if you have now testsuite I think it is time to make method little bit more obvious what it do like:

def GetServerBasename(server, server_args)
  arg = server == TCPD_BINARY ? server_args : server
  return nil unless arg

  arg = arg.dup # do we really modify arg???

  server_path = result.strip.split(/[ \t]/).first
  return server_path if server_path.empty?

  File.basename(server_path)
end

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice ! I have added. Thanks !


result
server_path = result.strip.split(/[ \t]/).first
Copy link
Member

Choose a reason for hiding this comment

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

typo, it should be arg.strip

Copy link
Member

Choose a reason for hiding this comment

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

btw test should show it to you ;)

Copy link
Member Author

Choose a reason for hiding this comment

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

* marvel * Yes, the testcase should crash here...

@kobliha
Copy link
Member

kobliha commented Sep 29, 2014

I'm sorry for being quite picky, but I'm still missing simple test for GetServerBasename

context "server binary is tcpd" do
  context "server name is defined in server_args" do
    it "returns server name from server_args" do
  context "server name is not defined in server_args" do
    it "returns empty name" do
context "server binary is not tcpd" do
  it "returns given server name" do

Yes, it's a big test, I know, but tests the API and the change you are doing in GMC phase

@schubi2
Copy link
Member Author

schubi2 commented Sep 30, 2014

Lukas, yes you are right. That's also the reason why the typo described above has not been found.

@schubi2
Copy link
Member Author

schubi2 commented Sep 30, 2014

I have added these testcases AND I have found an additional bug :-)


context "GetServerBasename: return basename of the real server" do
context "server binary is tcpd" do
let(:tcpd_name) { "/usr/sbin/tcpd" }
Copy link
Member

Choose a reason for hiding this comment

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

NTH: one empty line (separate let and context)

@jreidinger
Copy link
Member

LGTM

@kobliha
Copy link
Member

kobliha commented Oct 2, 2014

@schubi2 Will you merge it and close the bug?

@schubi2
Copy link
Member Author

schubi2 commented Oct 8, 2014

I have moved to review_140929_checking_nil_SLE-12-GA which is based on SLE-12-GA branch

@schubi2 schubi2 closed this Oct 8, 2014
@jreidinger jreidinger deleted the review_140929_checking_nil branch June 7, 2017 12:45
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.

None yet

3 participants