Unable to run ct_netconfc_SUITE testcase

When I try to run a testcase specified in the test suite ct_netconfc_SUITE, I am getting an error “Failed to start CTH, see the CT Log for details”. What could be the issue? Please give me pointer to resolve the issue. I did not find any clue in the CT log.

cd otp\lib\common_test
ct_run -suite test\ct_netconfc_SUITE -case get

Failed: "Failed to start CTH, see the CT Log for details", [{ct_netconfc_SUITE, init_per_suite}]
1 Like

I followed the procedure explained in TestingOTP. And, I run the following command.
make common_test_test ARGS="-suite ct_netconfc_SUITE -case get

The original error “Failed to start CTH…" is resolved now. However, I am getting a new error “crypto could not be loaded!”.

When I debugged it further, I see the module ct_netconfc_SUITE throws this error after checking whether the module “crypto” is loaded or not. How to resolve this issue?

1 Like

to investigate you should open index.html file and navigate to find more details. You probably have something like:

Failed to start a CTH: error:{undef, [{ts_install_cth,init, [#Ref<0.2036427769.1326186497.6271>,[]],

undef - is the keyword here. in details this says that ts_install_cth:init/2 is not defined. it is needed because the test suite expects installing test hook in suite/0 function - test framework tries to execute what test suite asks for, but fails (probably, because ts_install_cth BEAM file is not available in the execution path).

2 Likes

The dependency chain is something like: netconf → ssh → crypto → OpenSSL.
I would first check how you build process looks like (I assume you build OTP yourself). Security applications require OpenSSL dependency. If it is missing build process gives warnings in terminal and continues. As a result Erlang binary might have some limitations (such as not able to load crypto).

2 Likes

Thanks @kuba. I traversed through the index.html and finally found that the error was related to Test server ts “undef, [{ts_install_cth, init, [#Ref<0.2311414004.3980132358.140878>, ], }”. I could not debug it further. I moved to the other approach of building and running the OTP “make common_test_test”

The stacktrace is.
image

1 Like

After installing the required packages such as libssl-dev as explained in HOWTO, the issue “crypto could not be loaded!” got resolved, and the first step ct_netconfc_SUITE:init_per_suite is passed. But it failed at the next step ct_netconfc_SUITE:get with the following error. The error reason is unfortunately not giving any details about the function which has thrown “undef”. I need to debug it further. Any suggestion on debugging it further?

*** CT Error Notification 2022-12-29 18:36:41.657 ***
ct_netconfc_SUITE:get failed
Reason: {undef,[{ct_netconfc_SUITE,...},{...}|...]}
1 Like

Another query, ct_netconfc_SUITE will act as a Netconf client and tests the Netconf operations (I have tried with the Netconf operations “get” & “hello”). Which Netconf server does it try to connect with? Do I need to specify the Netconf Server details (IP, User credentials, etc)?

Unfortunately, it is a typical problem when starting with CT hooks. Before installing CT hook you need to ensure the hook module is compiled into BEAM file and present in the path for ct_run command (you can adjust path with ‘-pa’ argument).

A recent PR improves the CT hook docs (search for “-pa”):

1 Like
  • error says ct_netconfc_SUITE:get is undef
  • if you read source for ct_netconfc_SUITE you will find out it does not contain a test case named get
  • it is usually easier to start with executing whole test suite and then reduce the test scope if needed (you can see what tests are being executed and to which test groups they belong to)
  • I speculate you were after calling get from netconfc1_SUITE.erl - it is probably doable but I’m not sure how difficult it will be. I would recommend to start with executing ct_netconfc_SUITE.erl and then move on.
  • common_test have interesting test setup where test suites are called from test suites - it might take time to understand them
1 Like

search for ns.erl file - AFAIK it is a module with a server used in tests …

1 Like

Thanks @kuba for the clarification. I am able to run the complete test suite without specifying an individual testcase.
make common_test_test ARGS="-suite ct_netconfc_SUITE"

The netconfc1_SUITE.erl has various test cases such as “get”, and “hello”. I tried to run them individually as the whole test-suite testing was taking time.

ct_netconfc_SUITE.erl does not have “get” function. But, its all() refers to netconfc1_SUITE.erl which has a whole lot of Netconf test-cases.

1 Like

Thanks @kuba once again. Your are right, ns.erl simulates a Netconf Server. Let me explore it further.

2 Likes