diff --git a/src/__tests__/Explore/Explore.test.js b/src/__tests__/Explore/Explore.test.js
index 9df0f3a4..a4994919 100644
--- a/src/__tests__/Explore/Explore.test.js
+++ b/src/__tests__/Explore/Explore.test.js
@@ -127,6 +127,23 @@ const mockImageList = {
Count: 10
}
}
+ },
+ {
+ Name: 'base',
+ Size: '369311301',
+ LastUpdated: '2022-08-23T00:20:40.144281895Z',
+ NewestImage: {
+ Tag: 'latest',
+ Description: '',
+ IsSigned: true,
+ Licenses: '',
+ Vendor: '',
+ Labels: '',
+ Vulnerabilities: {
+ MaxSeverity: '',
+ Count: 10
+ }
+ }
}
]
}
@@ -167,7 +184,7 @@ describe('Explore component', () => {
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockImageList } });
render();
expect(await screen.findAllByTestId('unverified-icon')).toHaveLength(1);
- expect(await screen.findAllByTestId('verified-icon')).toHaveLength(5);
+ expect(await screen.findAllByTestId('verified-icon')).toHaveLength(6);
});
it('renders vulnerability icons', async () => {
@@ -178,7 +195,8 @@ describe('Explore component', () => {
expect(await screen.findAllByTestId('critical-vulnerability-icon')).toHaveLength(1);
expect(await screen.findAllByTestId('none-vulnerability-icon')).toHaveLength(1);
expect(await screen.findAllByTestId('medium-vulnerability-icon')).toHaveLength(1);
- // expect(await screen.findAllByTestId('unknown-vulnerability-icon')).toHaveLength(1);
+ expect(await screen.findAllByTestId('unknown-vulnerability-icon')).toHaveLength(1);
+ expect(await screen.findAllByTestId('failed-vulnerability-icon')).toHaveLength(1);
});
it("should log an error when data can't be fetched", async () => {
diff --git a/src/__tests__/RepoPage/Repo.test.js b/src/__tests__/RepoPage/Repo.test.js
index 26cb52ee..440f7dea 100644
--- a/src/__tests__/RepoPage/Repo.test.js
+++ b/src/__tests__/RepoPage/Repo.test.js
@@ -72,27 +72,49 @@ const mockRepoDetailsNone = {
}
};
-// const mockRepoDetailsUnknown = {
-// ExpandedRepoInfo: {
-// Images: [
-// {
-// Digest: '2aa7ff5ca352d4d25fc6548f9930a436aacd64d56b1bd1f9ff4423711b9c8718',
-// Tag: 'latest'
-// }
-// ],
-// Summary: {
-// Name: 'test1',
-// NewestImage: {
-// RepoName: 'mongo',
-// IsSigned: true,
-// Vulnerabilities: {
-// MaxSeverity: 'UNKNOWN',
-// Count: 15
-// }
-// }
-// }
-// }
-// };
+const mockRepoDetailsUnknown = {
+ ExpandedRepoInfo: {
+ Images: [
+ {
+ Digest: '2aa7ff5ca352d4d25fc6548f9930a436aacd64d56b1bd1f9ff4423711b9c8718',
+ Tag: 'latest'
+ }
+ ],
+ Summary: {
+ Name: 'test1',
+ NewestImage: {
+ RepoName: 'mongo',
+ IsSigned: true,
+ Vulnerabilities: {
+ MaxSeverity: 'UNKNOWN',
+ Count: 15
+ }
+ }
+ }
+ }
+};
+
+const mockRepoDetailsFailed = {
+ ExpandedRepoInfo: {
+ Images: [
+ {
+ Digest: '2aa7ff5ca352d4d25fc6548f9930a436aacd64d56b1bd1f9ff4423711b9c8718',
+ Tag: 'latest'
+ }
+ ],
+ Summary: {
+ Name: 'test1',
+ NewestImage: {
+ RepoName: 'mongo',
+ IsSigned: true,
+ Vulnerabilities: {
+ MaxSeverity: '',
+ Count: 15
+ }
+ }
+ }
+ }
+};
const mockRepoDetailsLow = {
ExpandedRepoInfo: {
@@ -179,9 +201,12 @@ describe('Repo details component', () => {
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockRepoDetailsNone } });
render();
expect(await screen.findAllByTestId('none-vulnerability-icon')).toHaveLength(1);
- // jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockRepoDetailsUnknown } });
- // render();
- // expect(await screen.findAllByTestId('unknown-vulnerability-icon')).toHaveLength(1);
+ jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockRepoDetailsUnknown } });
+ render();
+ expect(await screen.findAllByTestId('unknown-vulnerability-icon')).toHaveLength(1);
+ jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockRepoDetailsFailed } });
+ render();
+ expect(await screen.findAllByTestId('failed-vulnerability-icon')).toHaveLength(1);
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockRepoDetailsLow } });
render();
expect(await screen.findAllByTestId('low-vulnerability-icon')).toHaveLength(1);
diff --git a/src/__tests__/TagPage/TagDetails.test.js b/src/__tests__/TagPage/TagDetails.test.js
index 5c739764..b3a1ce31 100644
--- a/src/__tests__/TagPage/TagDetails.test.js
+++ b/src/__tests__/TagPage/TagDetails.test.js
@@ -101,6 +101,26 @@ const mockImageUnknown = {
}
};
+const mockImageFailed = {
+ Image: {
+ RepoName: 'centos',
+ Tag: '8',
+ Digest: 'sha256:63a795ca90aa6e7cca60941e826810a4cd0a2e73ea02bf458241df2a5c973e29',
+ LastUpdated: '2020-12-08T00:22:52.526672082Z',
+ Size: '75183423',
+ ConfigDigest: 'sha256:8dd57e171a61368ffcfde38045ddb6ed74a32950c271c1da93eaddfb66a77e78',
+ Platform: {
+ Os: 'linux',
+ Arch: 'amd64'
+ },
+ Vulnerabilities: {
+ MaxSeverity: '',
+ Count: 10
+ },
+ Vendor: 'CentOS'
+ }
+};
+
const mockImageLow = {
Image: {
RepoName: 'centos',
@@ -226,6 +246,10 @@ describe('Tags details', () => {
render();
expect(await screen.findByTestId('unknown-vulnerability-icon')).toBeInTheDocument();
+ jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockImageFailed } });
+ render();
+ expect(await screen.findByTestId('failed-vulnerability-icon')).toBeInTheDocument();
+
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockImageLow } });
render();
expect(await screen.findByTestId('low-vulnerability-icon')).toBeInTheDocument();
diff --git a/src/utilities/vulnerabilityAndSignatureCheck.js b/src/utilities/vulnerabilityAndSignatureCheck.js
index 676f3f65..296680fa 100644
--- a/src/utilities/vulnerabilityAndSignatureCheck.js
+++ b/src/utilities/vulnerabilityAndSignatureCheck.js
@@ -14,7 +14,10 @@ import {
VerifiedSignatureIcon,
UnverifiedSignatureChip,
VerifiedSignatureChip,
- UnknownVulnerabilityIcon
+ UnknownVulnerabilityIcon,
+ UnknownVulnerabilityChip,
+ FailedScanIcon,
+ FailedScanChip
} from './vulnerabilityAndSignatureComponents';
const VulnerabilityIconCheck = ({ vulnerabilitySeverity }) => {
@@ -42,6 +45,9 @@ const VulnerabilityIconCheck = ({ vulnerabilitySeverity }) => {
case 'UNKNOWN':
result = ;
break;
+ case '':
+ result = ;
+ break;
default:
result = <>>;
}
@@ -66,6 +72,12 @@ const VulnerabilityChipCheck = ({ vulnerabilitySeverity }) => {
case 'CRITICAL':
result = ;
break;
+ case 'UNKNOWN':
+ result = ;
+ break;
+ case '':
+ result = ;
+ break;
default:
result = <>>;
}
diff --git a/src/utilities/vulnerabilityAndSignatureComponents.jsx b/src/utilities/vulnerabilityAndSignatureComponents.jsx
index 99116875..4a62b264 100644
--- a/src/utilities/vulnerabilityAndSignatureComponents.jsx
+++ b/src/utilities/vulnerabilityAndSignatureComponents.jsx
@@ -39,6 +39,23 @@ const UnknownVulnerabilityIcon = ({ vulnerabilityStringTitle }) => {
);
};
+const FailedScanIcon = () => {
+ return (
+
+
+
+ );
+};
const LowVulnerabilityIcon = ({ vulnerabilityStringTitle }) => {
return (
@@ -136,6 +153,20 @@ const UnknownVulnerabilityChip = () => {
/>
);
};
+const FailedScanChip = () => {
+ return (
+ {
+ return;
+ }}
+ deleteIcon={}
+ data-testid="failed-vulnerability-chip"
+ />
+ );
+};
const LowVulnerabilityChip = () => {
return (