Running stubs in Istio or Kubernetes

After you publish one or more stubs to Istio or Kubernetes, you must upload the project files to a file server and edit the YAML file to point to the URL of the file server before you can run the stubs.

Uploading the tar.gz files

You must upload the tar.gz files for the project and library files, if available, to a file server. From the file server these files can be downloaded automatically when the YAML starts an intiContainer called fetch-project that is run before the stub container is started. The project and library files from this file server are fetched by the YAML file.

Editing the YAML file

You must edit the YAML file before you run the published stub. Complete the following steps to edit the YAML file:
  1. Open the YAML file for editing on your computer.
  2. Edit the curl command under the Deploying args: displayed as:
    - curl http://artifcats/files/<identifier name>_project.tar.gz
    where <identifier name> is the name of the project containing the stubs that you published to Kubernetes or Istio from HCL OneTest API, to input the URL of the file server and location of the files, as:
    - curl http://<URL of the file server/location of the files>/<identifier
                    _project.tar.gz
  3. Optionally, input the URL of the file server, location, and name of the library files in the corresponding curl command.
  4. Optionally, add the values for the FlexNet Licensing server URL and the ID of the FlexNet Licensing server, if you did not enter them in HCL OneTest API when you published the stubs to Kubernetes or Istio.
    
    env:
    - name: HCL_ONETEST_LICENSING_SERVER_URL
      value: '<URL of the License Server>'
    - name: HCL_ONETEST_LICENSING_SERVER_ID
      value: '<ID of the License Server>'
  5. Save and close the YAML file.

Running the stubs

Depending on the OS of the Kubernetes container where you are deploying the stub, you must run the appropriate command. For example, you must run the following command in a Linux container:

# kubectl apply -f <Directory path>/<identifier name>.yaml

The following are created in the Kubernetes cluster when you run the YAML file:
  • A deployment pod is created that uses the <identifer> name of the YAML file.
  • A service is created that uses the <identifer> name of the YAML file.
  • A virtual service is created for each HTTP host used by the stubs.