Skip to content

JDBC - MSSQL - getLivenessCheckPortNumbers() shouldn't that be the mapped port and not the internal? #5283

Closed

Description

@npetzall

@Override
public Set<Integer> getLivenessCheckPortNumbers() {
return Sets.newHashSet(MS_SQL_SERVER_PORT);
}

Mysql has the ports mapped

@NotNull
@Override
protected Set<Integer> getLivenessCheckPorts() {
return new HashSet<>(getMappedPort(MYSQL_PORT));
}

If the overrides are removed you would receive mapped ports of the exposedPorts.

Activity

  1. kiview commented on Jul 11, 2022

    @kiview
    Member

    Hey @npetzall, thanks for raising this issue. Your observation seems correct. In which scenarios would this lead to issues for you?

  2. npetzall commented on Jul 11, 2022

    @npetzall
    Author

    If I remember correctly I couldn't use the MSSQLServerContainer and had to extend it. Since it failed the liveliness check.

    This was on Windows so testcontainers tried to connect to 1433 or something like that but it was reachable on a different port.

  3. npetzall commented on Jul 11, 2022

    @npetzall
    Author

    I do also have a a custom wait strategy

    @Override
        protected void waitUntilContainerStarted() {
            new WaitAllStrategy()
                    .withStrategy(Wait.forListeningPort())
                    .withStrategy(Wait.forLogMessage("(?s).*default collation was successfully changed.*",1))
                    .waitUntilReady(this);
            super.waitUntilContainerStarted();
        }
    

    So it might be related to changes done that affect what is exposed or how the strategies work.

  4. kiview commented on Jul 11, 2022

    @kiview
    Member

    Thanks, this example makes sense.

  5. npetzall commented on Jul 11, 2022

    @npetzall
    Author

    It's a bit tricky since the JavaDoc only says ports to check if ready, but Wait.forListeningPort seems to assume that it's a published port.

  6. aidando73 commented on Oct 4, 2022

    @aidando73
    Contributor

    Thank you all for your contributions. This issue should be closed now. It's in the 1.17.4 release

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions