Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Identity] Fixing types on the Kubernetes manual test #17910

Merged
merged 3 commits into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc -p ."
},
"author": "",
"license": "ISC",
Expand All @@ -13,5 +14,8 @@
"@types/yargs": "15.0.3",
"@azure/identity": "2.0.0-beta.6",
"@azure/keyvault-secrets": "^4.0.2"
},
"devDependencies": {
"typescript": "^4.4.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const argv = yargs
.help()
.alias("help", "h").argv;

async function runCommand(command: string[], exitOnError = true) {
async function runCommand(command: string[], exitOnError = true): Promise<unknown> {
try {
if (argv.verbose) {
console.log(command);
Expand Down Expand Up @@ -85,7 +85,7 @@ async function main(): Promise<void> {
`image.repository=${argv.repository},image.name=${argv["image-name"]},image.tag=${argv["image-tag"]}`
];

runCommand(helm_install);
await runCommand(helm_install);

// get the name of the test pod
let podName = await runCommand([
Expand All @@ -96,7 +96,7 @@ async function main(): Promise<void> {
"--output=jsonpath='{.items[*].metadata.name}'"
sadasant marked this conversation as resolved.
Show resolved Hide resolved
]);

if (podName[0] == "'") {
if (typeof podName === "string" && podName[0] == "'") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (typeof podName === "string" && podName[0] == "'") {
if (typeof podName === "string" && podName.startsWith("'")) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why though? 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just seems more readable.

podName = podName.slice(1, -1);
}

Expand All @@ -113,7 +113,7 @@ async function main(): Promise<void> {
for (let x = 0; x < 10; ++x) {
// kubectl will return '' when there are no active pods
let active_pods = runCommand(count_active_pods);
logs = await runCommand(["kubectl", "logs", "-f", podName], false);
logs = await runCommand(["kubectl", "logs", "-f", podName as string], false);
if (!active_pods) break;
await sleep(30);
}
Expand Down