Skip to content

Commit

Permalink
Merge branch 'main' into fix/version_comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgamez authored Jan 22, 2025
2 parents ac6a920 + 8e7ae21 commit a3f993f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
28 changes: 18 additions & 10 deletions scripts/tunnel-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ PORT="5432"
TARGET_PORT="5432"
TARGET_ACCOUNT=""
DB_INSTANCE=""
RETRY_INTERVAL=5
MAX_RETRIES=12

display_usage() {
printf "\nThis script creates a SSH tunnel between the local machine and a GCP database using a GCP instance deployed in the same VPC."
Expand Down Expand Up @@ -137,15 +139,21 @@ fi
# Getting the first IP
ip=$(echo $ips | sed "s/\['\([^']*\)'.*/\1/")

# Wait 15s to allow the machine to be up before creating the tunnel
echo "Sleeping for 15s..."
sleep 15
echo "Compute engine should be ready to use now"

# Creating SSH tunnel
ssh -o StrictHostKeyChecking=no -fN -L ${PORT}:${target_ip}:${TARGET_PORT} ${TARGET_ACCOUNT}@${ip}
# Creating SSH tunnel with retry mechanism
retry_count=0
while [ $retry_count -lt $MAX_RETRIES ]; do
ssh -o StrictHostKeyChecking=no -fN -L ${PORT}:${target_ip}:${TARGET_PORT} ${TARGET_ACCOUNT}@${ip}
if [ $? -eq 0 ]; then
echo "SSH tunnel created successfully"
break
else
echo "Error creating SSH tunnel, retrying in ${RETRY_INTERVAL}s..."
sleep ${RETRY_INTERVAL}
retry_count=$((retry_count + 1))
fi
done

if [ $? -ne 0 ]; then
printf "\nError creating SSH tunnel\n"
if [ $retry_count -eq $MAX_RETRIES ]; then
printf "\nError creating SSH tunnel after ${MAX_RETRIES} attempts\n"
exit 1
fi
fi
2 changes: 2 additions & 0 deletions web-app/src/app/interface/RemoteConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface RemoteConfigValues extends FirebaseDefaultConfig {
featureFlagBypass: string;
enableFeatureFilterSearch: boolean;
enableIsOfficialFilterSearch: boolean;
enableFeedStatusBadge: boolean;
}

const featureByPassDefault: BypassConfig = {
Expand All @@ -50,6 +51,7 @@ export const defaultRemoteConfigValues: RemoteConfigValues = {
featureFlagBypass: JSON.stringify(featureByPassDefault),
enableFeatureFilterSearch: false,
enableIsOfficialFilterSearch: false,
enableFeedStatusBadge: false,
};

remoteConfig.defaultConfig = defaultRemoteConfigValues;
6 changes: 5 additions & 1 deletion web-app/src/app/screens/Feed/DataQualitySummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import VerifiedIcon from '@mui/icons-material/Verified';
import { useTranslation } from 'react-i18next';
import { verificationBadgeStyle } from '../../styles/VerificationBadge.styles';
import { FeedStatusChip } from '../../components/FeedStatus';
import { useRemoteConfig } from '../../context/RemoteConfigProvider';

export interface DataQualitySummaryProps {
feedStatus: components['schemas']['BasicFeed']['status'];
Expand All @@ -21,14 +22,17 @@ export default function DataQualitySummary({
latestDataset,
}: DataQualitySummaryProps): React.ReactElement {
const { t } = useTranslation('feeds');
const { config } = useRemoteConfig();
return (
<Box data-testid='data-quality-summary' sx={{ my: 2 }}>
{(latestDataset?.validation_report === undefined ||
latestDataset.validation_report === null) && (
<WarningContentBox>{t('errorLoadingQualityReport')}</WarningContentBox>
)}
<Box sx={{ display: 'flex', gap: 1, flexWrap: 'wrap' }}>
<FeedStatusChip status={feedStatus ?? ''}></FeedStatusChip>
{config.enableFeedStatusBadge && (
<FeedStatusChip status={feedStatus ?? ''}></FeedStatusChip>
)}
{isOfficialFeed && (
<Tooltip title={t('officialFeedTooltip')} placement='top'>
<Chip
Expand Down
7 changes: 7 additions & 0 deletions web-app/src/app/screens/Feed/Feed.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ const mockFeedRT: GTFSRTFeedType = {
feed_references: ['mdb-y'],
};

jest.mock('firebase/compat/app', () => ({
initializeApp: jest.fn(),
remoteConfig: jest.fn(() => ({
settings: { minimumFetchIntervalMillis: 3600000 },
})),
}));

describe('Feed page', () => {
afterEach(cleanup);

Expand Down

0 comments on commit a3f993f

Please sign in to comment.