mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
test: Fix kube-api-version-detection tests
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
5dc94f291b
commit
43f3059c9b
@ -318,20 +318,24 @@ export class KubeApi<
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { apiPrefix, apiGroup, resource } = parsedApi;
|
try {
|
||||||
const list = await this.request.get(`${apiPrefix}/${apiGroup}`) as KubeApiResourceVersionList;
|
const { apiPrefix, apiGroup, resource } = parsedApi;
|
||||||
const resourceVersions = getOrderedVersions(list, this.allowedUsableVersions?.[apiGroup]);
|
const list = await this.request.get(`${apiPrefix}/${apiGroup}`) as KubeApiResourceVersionList;
|
||||||
|
const resourceVersions = getOrderedVersions(list, this.allowedUsableVersions?.[apiGroup]);
|
||||||
|
|
||||||
for (const resourceVersion of resourceVersions) {
|
for (const resourceVersion of resourceVersions) {
|
||||||
const { resources } = await this.request.get(`${apiPrefix}/${resourceVersion.groupVersion}`) as KubeApiResourceList;
|
const { resources } = await this.request.get(`${apiPrefix}/${resourceVersion.groupVersion}`) as KubeApiResourceList;
|
||||||
|
|
||||||
if (resources.some(({ name }) => name === resource)) {
|
if (resources.some(({ name }) => name === resource)) {
|
||||||
return {
|
return {
|
||||||
apiPrefix,
|
apiPrefix,
|
||||||
apiGroup,
|
apiGroup,
|
||||||
apiVersionPreferred: resourceVersion.version,
|
apiVersionPreferred: resourceVersion.version,
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch {
|
||||||
|
// ignore exception to try next url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user