This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How do we init the SDK when using Docker containers?

We use Visual Studio 2017 as our IDE with LeanFT 14.53.222. Up until now we've been running the LFTRuntime on the local machine when executing tests but we're looking into using Docker containers instead so that clients can pull down our packaged code and execute test cases themselves that way.

I have the leanft-chrome:14.53 Docker image downloaded and the container is running successfully using the following command:

docker run -it -p 5095:5095 -p 5900:5900 --add-host=license-server:##.##.##.## --env LFT_LIC_ID=10594 functionaltesting/leanft-chrome:14.53

It outputs the following in the command prompt window:

LeanFT local module started successfully
License: Concurrent UFT Enterprise Concurrent User
Role: local
Port: 5095
UsingSecuredConnection: false
Version: 14.53.222, (c) Copyright 2015 - 2018 Micro Focus or one of its affiliates.
Installation Folder: /opt/leanft
Executing stand-alone mode

The problem I'm having is with how to initialize the LeanFT SDK in our code. Normally we use the following:

if (SDK.IsServerReady == false)
{
    Uri serverAddress = new Uri(ClientURL);   //ClientURL = "ws://localhost:5095"
    SDK.Init(new SdkConfiguration { ServerAddress = serverAddress });
}

This works OK when using the LFTRuntime but it's throwing an HP.LFT.Common.ErrorHandling.NoValidLicenseException with the Docker container in the SDK.Init call: "No valid license is installed, or license communication error". 

Is there something I should be doing differently? 

  • 0

    I got it working by adding a LFT_LIC_ID environment variable in windows and setting it to the license ID. 

  • 0

    The version of the Docker Engine API you should use depends upon the version of your Docker daemon and Docker client.

    A given version of the Docker Engine SDK supports a specific version of the Docker Engine API, as well as all earlier versions. If breaking changes occur, they are documented prominently.
    A new version of the API is released when new features are added. The Docker API is backward-compatible, so you do not need to update the code that uses the API unless you need to take advantage of new features.
    You can specify the API version to use, in one of the following ways:

    When using the SDK, use the latest version you can, but at least the version that incorporates the API version with the features you need.

    When using curl directly, specify the version as the first part of the site URL. For instance, if the endpoint is /containers/, you can use /v1.41/containers/.

    To force the Docker CLI or the Docker Engine SDKs to use an old version of the API than the version reported by the docker version, set the environment variable DOCKER_API_VERSION to the correct version. This works on Linux, Windows, or macOS clients