-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [M3-7487] - Add AGLB Endpoint Health (#10008)
* add load balancer endpoint health api call and query * and mocks and inital ui * add health to summary tab and add unit test * add endpoint health to configurations * add service target endpoint health * add test and improve some comments * add unit testing * add more testing and comments * Added changeset: AGLB endpoint health endpoints * add changeset * fix spelling of `LoadBalancerEndpontHeath` ➡️ `LoadBalancerEndpointHealth` * add minimum with to skeleton so that loading state is not tiny * hide `Endpoints:` if there is no status for a configuration * update tense `Added` ➡️ `Add` in the changeset * Make Configurations health behavior consistent with others --------- Co-authored-by: Banks Nussman <banks@nussman.us>
- Loading branch information
1 parent
384d00b
commit be1d910
Showing
27 changed files
with
661 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/api-v4": Added | ||
--- | ||
|
||
AGLB endpoint health endpoints ([#10008](https://github.com/linode/manager/pull/10008)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/manager/.changeset/pr-10008-upcoming-features-1704919046550.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Upcoming Features | ||
--- | ||
|
||
Add AGLB Endpoint Health ([#10008](https://github.com/linode/manager/pull/10008)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...res/LoadBalancers/LoadBalancerDetail/Configurations/ConfigurationAccordionHeader.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
configurationFactory, | ||
configurationsEndpointHealthFactory, | ||
endpointHealthFactory, | ||
} from 'src/factories'; | ||
import { rest, server } from 'src/mocks/testServer'; | ||
import { renderWithTheme } from 'src/utilities/testHelpers'; | ||
|
||
import { ConfigurationAccordionHeader } from './ConfigurationAccordionHeader'; | ||
|
||
describe('ConfigurationAccordionHeader', () => { | ||
it('renders configuration information', () => { | ||
const configuration = configurationFactory.build({ routes: [] }); | ||
|
||
const { getByText } = renderWithTheme( | ||
<ConfigurationAccordionHeader | ||
configuration={configuration} | ||
loadbalancerId={0} | ||
/> | ||
); | ||
|
||
// Label | ||
expect(getByText(configuration.label)).toBeVisible(); | ||
|
||
// ID | ||
expect(getByText(`ID: ${configuration.id}`)).toBeVisible(); | ||
|
||
// Port | ||
expect( | ||
getByText(`Port ${configuration.port}`, { exact: false }) | ||
).toBeVisible(); | ||
|
||
// Number of Routes | ||
expect(getByText('0 Routes', { exact: false })).toBeVisible(); | ||
}); | ||
|
||
it('renders endpoint health for a configuration', async () => { | ||
const configuration = configurationFactory.build({ routes: [] }); | ||
|
||
const configurationHealth = endpointHealthFactory.build({ | ||
healthy_endpoints: 5, | ||
id: configuration.id, | ||
total_endpoints: 9, | ||
}); | ||
|
||
const allConfigurationsEndpointHealth = configurationsEndpointHealthFactory.build( | ||
{ | ||
configurations: [configurationHealth], | ||
id: 5, | ||
} | ||
); | ||
|
||
server.use( | ||
rest.get( | ||
'*/v4beta/aglb/5/configurations/endpoints-health', | ||
(req, res, ctx) => res(ctx.json(allConfigurationsEndpointHealth)) | ||
) | ||
); | ||
|
||
const { findByText } = renderWithTheme( | ||
<ConfigurationAccordionHeader | ||
configuration={configuration} | ||
loadbalancerId={5} | ||
/> | ||
); | ||
|
||
await findByText('5 up'); | ||
|
||
await findByText('4 down'); // 9 - 5 | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...ures/LoadBalancers/LoadBalancerDetail/Configurations/ConfigurationEndpointHealth.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
configurationsEndpointHealthFactory, | ||
endpointHealthFactory, | ||
} from 'src/factories'; | ||
import { rest, server } from 'src/mocks/testServer'; | ||
import { renderWithTheme } from 'src/utilities/testHelpers'; | ||
|
||
import { ConfigurationEndpointHealth } from './ConfigurationEndpointHealth'; | ||
|
||
describe('ConfigurationEndpointHealth', () => { | ||
it('renders endpoint health from API data', async () => { | ||
server.use( | ||
rest.get( | ||
'*/v4beta/aglb/:id/configurations/endpoints-health', | ||
(req, res, ctx) => { | ||
const health = configurationsEndpointHealthFactory.build({ | ||
configurations: [ | ||
endpointHealthFactory.build({ | ||
healthy_endpoints: 10, | ||
id: 0, | ||
total_endpoints: 20, | ||
}), | ||
], | ||
}); | ||
return res(ctx.json(health)); | ||
} | ||
) | ||
); | ||
|
||
const { findByText } = renderWithTheme( | ||
<ConfigurationEndpointHealth configurationId={0} loadBalancerId={0} /> | ||
); | ||
|
||
await findByText('10 up'); // 20 - 10 = 10 | ||
|
||
await findByText('10 down'); // 20 - 10 = 10 | ||
}); | ||
}); |
Oops, something went wrong.