Troubleshoot linting and testing

Linting

All Itential built adapters as well as adapters built by the Adapter Builder include lint rules and scripts. In order to run lint, you need to make sure the adapter devDependencies have been loaded.

Lint the adapter when you first install it to make sure it lints clean. To do this run npm run lint:errors in the /adapter-home-dir. While linting errors are not always related to run time issues, fixing linting issues can often help you prevent run time issues from occurring. Most adapters have a large number of warnings so we are not really concerned about those. By running lint:errors instead of just lint, you will not see all the warnings, only the errors. This makes it much easier to find the issues that could be impacting your adapter.

As a best practice always make sure the adapter lints clean after making any code or configuration changes.

If the adapter does not lint properly, the adapter may fail to load whenItential Platform is restarted. Lint issues can also cause runtime issues with calls to the other system.

Testing

All Itential built adapters as well as adapters built by the Adapter Builder include test scripts. In most adapters, the dependencies required to run tests are regular dependencies and not devDependencies. This is because some of the adapter scripts for checking health and troubleshooting utilize the tests.

Test the adapter when you first install it to make sure it test clean. There are adapter base, unit, and integration tests that come with the adapter. You can run them together (npm run test). If however, there are errors during testing, you may want to run them separately. To run separately:

adapter base test: npm run test:baseunit unit test: npm run test:unit integration test: npm run test:integration The unit test includes a test to check that the adapter.js and pronghorn.json methods are in sync. This is a useful test to verify that tasks inItential Platform Automation Studio will be passing the right parameters into the adapter. This test can take a significant amount of time for large adapters (e.g. 5-10 minutes). There is additional information in the article on Key Unit Tests

The integration tests are run in stub mode and so they make use of any mock data that has been provided with the adapter. There is additional information in the article on Key Integration Tests

While testing errors are not always related to run time issues, fixing testing issues can often help you prevent run time issues from occurring.

As a best practice always make sure the adapter tests clean after making any code or configuration changes.

If the adapter does not test properly, the adapter can have runtime issues with 1 or more calls to the other system.