-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(machines): Allow ports at the end of IPMI addresses LP#2087965 (#…
…5560) Resolves [LP#2087965](https://bugs.launchpad.net/maas/+bug/2087965)
- Loading branch information
Showing
5 changed files
with
163 additions
and
5 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { isValidPortNumber } from "."; | ||
|
||
it("returns true for any number between 0 and 65535", () => { | ||
for (let i = 0; i <= 65535; i++) { | ||
expect(isValidPortNumber(i)).toBe(true); | ||
} | ||
}); | ||
|
||
it("returns false for numbers larger than 65535", () => { | ||
expect(isValidPortNumber(65536)).toBe(false); | ||
}); | ||
|
||
it("returns false for numbers smaller than 0", () => { | ||
expect(isValidPortNumber(-1)).toBe(false); | ||
}); |
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,9 @@ | ||
/** | ||
* Checks if a given port number is valid (between 0 and 65535). | ||
* | ||
* @param port The port number to check. | ||
* @returns True if valid, false otherwise. | ||
*/ | ||
export const isValidPortNumber = (port: number): boolean => { | ||
return port >= 0 && port <= 65535; | ||
}; |