Skip to content

Commit

Permalink
Merge branch 'master' into long-content-training-cards
Browse files Browse the repository at this point in the history
  • Loading branch information
latin-panda authored Oct 7, 2024
2 parents 587fa3a + 2ac8970 commit b2bdc2f
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 23 deletions.
2 changes: 1 addition & 1 deletion scripts/deploy/src/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import path from 'path';
const MEDIC_REPO_NAME = 'medic';
const MEDIC_REPO_URL = 'https://docs.communityhealthtoolkit.org/helm-charts';
const CHT_CHART_NAME = `${MEDIC_REPO_NAME}/cht-chart-4x`;
const DEFAULT_CHART_VERSION = '1.0.*';
const DEFAULT_CHART_VERSION = '1.1.*';

import { fileURLToPath } from 'url';
import { obtainCertificateAndKey, createSecret } from './certificate.js';
Expand Down
69 changes: 69 additions & 0 deletions scripts/deploy/troubleshooting/get-volume-binding
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash

if [ "$#" -ne 2 ]; then
echo "Usage: $0 <namespace> <deployment>"
exit 1
fi

NAMESPACE=$1
DEPLOYMENT=$2

get_pv_details() {
local pvc_name=$1
local pv_name
pv_name=$(kubectl get pvc -n "$NAMESPACE" "$pvc_name" -o jsonpath='{.spec.volumeName}' 2>/dev/null)
if [ -n "$pv_name" ]; then
kubectl get pv "$pv_name" -o json 2>/dev/null | jq '{
pvName: .metadata.name,
pvSize: .spec.capacity.storage,
storageClass: .spec.storageClassName,
pvAccessModes: .spec.accessModes
}'
else
echo "{}"
fi
}

if ! DEPLOYMENT_INFO=$(kubectl get deployment -n "$NAMESPACE" "$DEPLOYMENT" -o json 2>&1); then
echo "Error: Failed to get deployment information"
echo "$DEPLOYMENT_INFO"
exit 1
fi

echo "$DEPLOYMENT_INFO" | jq --arg namespace "$NAMESPACE" '
.spec.template.spec.containers[].volumeMounts[] as $vm |
.spec.template.spec.volumes[] |
select(.name == $vm.name) |
select($vm.mountPath | endswith("local.d") | not) |
{
mountPath: $vm.mountPath,
name: $vm.name,
subPath: $vm.subPath,
volumeType: (
if .persistentVolumeClaim then "PVC"
elif .hostPath then "HostPath"
else "Other"
end
),
claimName: (
if .persistentVolumeClaim then .persistentVolumeClaim.claimName
else null
end
),
hostPath: (
if .hostPath then .hostPath.path
else null
end
)
}' | jq -c '.' | while read -r volume_info; do
claim_name=$(echo "$volume_info" | jq -r '.claimName // empty')
if [ -n "$claim_name" ]; then
pv_info=$(get_pv_details "$claim_name")
echo "$volume_info" | jq --argjson pv_info "$pv_info" '. + $pv_info'
else
echo "$volume_info"
fi
done || {
echo "Error: Failed to process deployment information"
exit 1
}
33 changes: 12 additions & 21 deletions tests/e2e/upgrade/upgrade.wdio-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ describe('Performing an upgrade', () => {
if (testFrontend) {
// a variety of selectors that we use in e2e tests to interact with webapp
// are not compatible with older versions of the app.
await loginPage.login({ username: docs.user.username, password: docs.user.password, loadPage: false });
await oldNavigationPage.goToBase();
await oldNavigationPage.logout();
await loginPage.login({ username: docs.user.username, password: docs.user.password });
await commonPage.logout();
await loginPage.login({ username: constants.USERNAME, password: constants.PASSWORD, adminApp: true });
return;
}

await loginPage.login({ username: constants.USERNAME, password: constants.PASSWORD, loadPage: false });
Expand All @@ -71,7 +72,7 @@ describe('Performing an upgrade', () => {
await utils.revertDb([/^form:/], true);
});

it('should have an upgrade_log after installing', async () => {
it('should have an upgrade_log after installing the app, without logs upgrade is aborted', async () => {
const logs = await getUpgradeLogs();
expect(logs.length).to.equal(1);
expect(logs[0]).to.include({
Expand All @@ -80,11 +81,7 @@ describe('Performing an upgrade', () => {
});
});

it('should have valid semver after installing', async () => {
if (!testFrontend) {
return;
}

(testFrontend ? it : xit)('should have valid semver after installing', async () => {
const deployInfo = await utils.request({ path: '/api/deploy-info' });
expect(semver.valid(deployInfo.version)).to.be.ok;
});
Expand Down Expand Up @@ -117,17 +114,15 @@ describe('Performing an upgrade', () => {
state: 'finalized',
});

if (!testFrontend) {
return;
}

await adminPage.logout();
await loginPage.login({ username: docs.user.username, password: docs.user.password, loadPage: false });
await oldNavigationPage.goToBase();
await oldNavigationPage.sync(true);
});

(testFrontend ? it : xit)('should display current branch in the about page', async () => {
await loginPage.login({ username: docs.user.username, password: docs.user.password });
await commonPage.sync(true);
await browser.refresh();
await commonPage.waitForPageLoaded();

await commonPage.goToAboutPage();
await (await aboutPage.aboutCard()).waitForDisplayed();
const expected = TAG || `${utils.escapeBranchName(BRANCH)} (`;
Expand All @@ -136,12 +131,8 @@ describe('Performing an upgrade', () => {
});

it('should display upgrade page even without upgrade logs', async () => {
if (testFrontend) {
await loginPage.login({ username: constants.USERNAME, password: constants.PASSWORD, adminApp: true });
}

await loginPage.login({ username: constants.USERNAME, password: constants.PASSWORD, adminApp: true });
await deleteUpgradeLogs();

await upgradePage.goToUpgradePage();

const currentVersion = await upgradePage.getCurrentVersion();
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/css/sidebar-filter.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
height: 100%;
padding: 0;
position: fixed;
right: -500px;
right: -2000px;
}

.sidebar-filter-active {
Expand Down

0 comments on commit b2bdc2f

Please sign in to comment.