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

Parse custom net box URI (Unix socket) correctly #323

Merged
merged 3 commits into from
Sep 8, 2023

Conversation

ylobankov
Copy link
Contributor

@ylobankov ylobankov commented Sep 5, 2023

Until this moment, luatest didn't parse a custom net box URI correctly
in the case of a Unix socket if it was as follows:

unix/:/tmp/foo1/bar1.iproto
login:password@unix/:/tmp/foo2/bar2.iproto

So it created wrong directories for such sockets:

unix/:/tmp/foo1/
login:password@unix/:/tmp/foo2/

instead of correct ones:

/tmp/foo1/
/tmp/foo2/

Now this is fixed.

Fixes #313

@ylobankov ylobankov marked this pull request as draft September 5, 2023 12:33
@ylobankov ylobankov force-pushed the ylobankov/fix-net-box-uri branch 2 times, most recently from 07bd6cf to f162f45 Compare September 6, 2023 18:22
@ylobankov ylobankov changed the title Consider login and password in net box URI Parse custom net box URI (Unix socket) correctly Sep 6, 2023
@ylobankov ylobankov marked this pull request as ready for review September 6, 2023 18:40
@ylobankov ylobankov force-pushed the ylobankov/fix-net-box-uri branch 2 times, most recently from e548d64 to 0cb27d9 Compare September 6, 2023 21:54
luatest/server.lua Outdated Show resolved Hide resolved
luatest/server.lua Outdated Show resolved Hide resolved
Copy link
Member

@Totktonada Totktonada left a comment

Choose a reason for hiding this comment

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

No objections from my side (after a brief glance).

@ylobankov ylobankov force-pushed the ylobankov/fix-net-box-uri branch 2 times, most recently from 4ce8ef8 to f337a1f Compare September 7, 2023 12:41
Until this moment, luatest didn't parse a custom net box URI correctly
in the case of a Unix socket if it was as follows:

    unix/:/tmp/foo1/bar1.iproto
    login:password@unix/:/tmp/foo2/bar2.iproto

So it created wrong directories for such sockets:

    unix/:/tmp/foo1/
    login:password@unix/:/tmp/foo2/

instead of correct ones:

    /tmp/foo1/
    /tmp/foo2/

Now this is fixed.

Fixes #313
I don't like creating files, directories, whatever at the point of the
'class instance' initialization -- the `new` function. It's more logical
and gently to create all required resources on the start.
The conditions like

    if a == nil and b == nil then
        c = 'something'
    end
    if a == nil and b then
        c = 'something else'
    end

going in a row look a little strange.

This patch groups similar conditions from the `Server:initialize`
function into the following construction:

    if a == nil then
        if b == nil then
            c = 'something'
        else
            c = 'something else'
        end
    end
Copy link

@ochaplashkin ochaplashkin left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@ylobankov ylobankov merged commit a188577 into master Sep 8, 2023
8 checks passed
@ylobankov ylobankov deleted the ylobankov/fix-net-box-uri branch September 8, 2023 08:11
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.

server.new() creates unnecessary directories
3 participants