OpenSearch-Dashboards
OpenSearch-Dashboards copied to clipboard
[BUG] Unit Tests failing on Amazon Linux 2 docker image due to OS-level or Docker-related wording difference
trafficstars
Describe the bug Unit Tests failing on Amazon Linux 2 docker image. IMO, unit tests should not be coupled with OS-level wording difference. The 3 failed unit tests are checking for text containing "permission denied", which exists on Debian-based OS. But AL2 is CentOS based, and it throws out "UV_EACCES" instead.
A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks. Active timers can also cause this, ensure that .unref() was called on them.
Summary of all failing tests
FAIL src/core/server/plugins/discovery/plugins_discovery.test.ts (23.132 s)
● plugins discovery system › return errors when the plugin search path is not accessible
expect(received).toEqual(expected) // deep equality
Expected: ArrayContaining [StringContaining "Error: EACCES, permission denied '/home/jenkins/workspace/OSD-testing_opensearch-3.1.0-dev/OpenSearch-Dashboards/src/plugins"]
Received: ["Error: EACCES, UV_EACCES '/home/jenkins/workspace/OSD-testing_opensearch-3.1.0-dev/OpenSearch-Dashboards/src/plugins' (invalid-search-path, /home/jenkins/workspace/OSD-testing_opensearch-3.1.0-dev/OpenSearch-Dashboards/src/plugins)", "Error: ENOENT, UV_ENOENT '/home/jenkins/workspace/OSD-testing_opensearch-3.1.0-dev/OpenSearch-Dashboards/plugins' (invalid-search-path, /home/jenkins/workspace/OSD-testing_opensearch-3.1.0-dev/OpenSearch-Dashboards/plugins)", "Error: ENOENT, UV_ENOENT '/home/jenkins/workspace/OSD-testing_opensearch-3.1.0-dev/opensearch-dashboards-extra' (invalid-search-path, /home/jenkins/workspace/OSD-testing_opensearch-3.1.0-dev/opensearch-dashboards-extra)"]
238 |
239 | const srcPluginsPath = resolve(PROCESS_WORKING_DIR, 'src', 'plugins');
> 240 | expect(errors).toEqual(
| ^
241 | expect.arrayContaining([
242 | expect.stringContaining(`Error: EACCES, permission denied '${standardize(srcPluginsPath)}`),
243 | ])
at Object.<anonymous> (src/core/server/plugins/discovery/plugins_discovery.test.ts:240:20)
● plugins discovery system › return an error when the manifest file is not accessible
expect(received).toEqual(expected) // deep equality
Expected: ArrayContaining [StringContaining "Error: EACCES, permission denied '/home/jenkins/workspace/OSD-testing_opensearch-3.1.0-dev/OpenSearch-Dashboards/src/plugins/plugin_a/opensearch_dashboards.json"]
Received: ["Error: ENOENT, UV_ENOENT '/home/jenkins/workspace/OSD-testing_opensearch-3.1.0-dev/OpenSearch-Dashboards/plugins' (invalid-search-path, /home/jenkins/workspace/OSD-testing_opensearch-3.1.0-dev/OpenSearch-Dashboards/plugins)", "Error: ENOENT, UV_ENOENT '/home/jenkins/workspace/OSD-testing_opensearch-3.1.0-dev/opensearch-dashboards-extra' (invalid-search-path, /home/jenkins/workspace/OSD-testing_opensearch-3.1.0-dev/opensearch-dashboards-extra)", "Error: EACCES, UV_EACCES '/home/jenkins/workspace/OSD-testing_opensearch-3.1.0-dev/OpenSearch-Dashboards/src/plugins/plugin_a/opensearch_dashboards.json' (missing-manifest, /home/jenkins/workspace/OSD-testing_opensearch-3.1.0-dev/OpenSearch-Dashboards/src/plugins/plugin_a/opensearch_dashboards.json)"]
273 |
274 | const errorPath = manifestPath('plugin_a');
> 275 | expect(errors).toEqual(
| ^
276 | expect.arrayContaining([
277 | expect.stringContaining(`Error: EACCES, permission denied '${standardize(errorPath)}`),
278 | ])
at Object.<anonymous> (src/core/server/plugins/discovery/plugins_discovery.test.ts:275:20)
FAIL src/core/server/metrics/collectors/cgroup.test.ts
● OsCgroupMetricsCollector › returns empty object and logs error on an EACCES error
expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: "cgroup metrics could not be read due to error: [Error: EACCES, permission denied '/sys/fs/cgroup/cpuacct/groupname/cpuacct.usage']"
Received: "cgroup metrics could not be read due to error: [Error: EACCES, UV_EACCES '/sys/fs/cgroup/cpuacct/groupname/cpuacct.usage']"
Number of calls: 1
148 | const collector = new OsCgroupMetricsCollector({ logger });
149 | expect(await collector.collect()).toEqual({});
> 150 | expect(logger.error).toHaveBeenCalledWith(
| ^
151 | `cgroup metrics could not be read due to error: [Error: EACCES, permission denied '${usagePath}']`
152 | );
153 | });
at Object.<anonymous> (src/core/server/metrics/collectors/cgroup.test.ts:150:26)
To Reproduce Steps to reproduce the behavior:
- Use AL2 docker image
- run yarn test:jest
Expected behavior A clear and concise description of what you expected to happen.