mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
## Problem - Older orioledb projects show "Public Beta" instead of "Public Alpha" in UI. - List of backups in the "Scheduled backups" tab hangs. ## Solution - show in the UI "Public Alpha" for projects older than 17.11.0.001-orioledb - show in the UI "Public Beta" for new projects - enable scheduled-backup query for "Public Beta" <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Backup availability messages now reflect OrioleDB’s current release stage rather than always describing it as public beta. * AWS backup queries are no longer disabled for every OrioleDB project; they remain disabled during the alpha stage. * **New Features** * Added an informational notice and documentation link for scheduled backups on AWS OrioleDB projects in alpha. * Added release-stage details to the PITR availability notice. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>
152 lines
4.8 KiB
TypeScript
152 lines
4.8 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import {
|
|
appVersionAtLeast,
|
|
compareAppVersions,
|
|
isOrioleDbVersionAtLeast,
|
|
parseAppVersionKey,
|
|
} from './useSelectedProject.utils'
|
|
|
|
describe('parseAppVersionKey', () => {
|
|
it('parses a dbVersion string into a version key', () => {
|
|
expect(parseAppVersionKey('supabase-postgres-17.9.9.999-orioledb')).toEqual([17, 9, 9, 999])
|
|
})
|
|
|
|
it('parses dbVersion strings with an arch prefix', () => {
|
|
expect(parseAppVersionKey('supabase-postgres-arm64-17.9.0.019')).toEqual([17, 9, 0, 19])
|
|
expect(parseAppVersionKey('supabase-postgres-x86_64-17.9.0.019')).toEqual([17, 9, 0, 19])
|
|
})
|
|
|
|
it('returns null for non-conforming strings', () => {
|
|
expect(parseAppVersionKey('CUSTOM_AMI_SENTINEL')).toBeNull()
|
|
expect(parseAppVersionKey('not-a-version')).toBeNull()
|
|
})
|
|
|
|
it('returns null for null or undefined input', () => {
|
|
expect(parseAppVersionKey(null)).toBeNull()
|
|
expect(parseAppVersionKey(undefined)).toBeNull()
|
|
})
|
|
})
|
|
|
|
describe('compareAppVersions', () => {
|
|
it('returns a negative number when a is older than b', () => {
|
|
expect(
|
|
compareAppVersions('supabase-postgres-17.8.9.999', 'supabase-postgres-17.9.0.019')
|
|
).toBeLessThan(0)
|
|
})
|
|
|
|
it('returns zero when versions are equal', () => {
|
|
expect(compareAppVersions('supabase-postgres-17.9.0.019', 'supabase-postgres-17.9.0.019')).toBe(
|
|
0
|
|
)
|
|
})
|
|
|
|
it('returns a positive number when a is newer than b', () => {
|
|
expect(
|
|
compareAppVersions('supabase-postgres-17.11.0.001', 'supabase-postgres-17.9.0.019')
|
|
).toBeGreaterThan(0)
|
|
})
|
|
|
|
it('compares numerically rather than by segment digit-width', () => {
|
|
// Regression case for the digit-concatenation bug in lib/helpers.ts'
|
|
// getSemanticVersion, where '15.1.1.2' (-> '15112') compares as less than
|
|
// '14.1.0.44' (-> '141044') despite being the newer version.
|
|
expect(
|
|
compareAppVersions('supabase-postgres-15.1.1.2', 'supabase-postgres-14.1.0.44')
|
|
).toBeGreaterThan(0)
|
|
})
|
|
|
|
it('throws on unparseable input', () => {
|
|
expect(() => compareAppVersions('not-a-version', 'supabase-postgres-17.9.0.019')).toThrow()
|
|
expect(() => compareAppVersions('supabase-postgres-17.9.0.019', 'not-a-version')).toThrow()
|
|
})
|
|
})
|
|
|
|
describe('appVersionAtLeast', () => {
|
|
it('returns true when the version is above or equal to the threshold', () => {
|
|
expect(appVersionAtLeast('supabase-postgres-17.9.9.999', 'supabase-postgres-17.9.0.019')).toBe(
|
|
true
|
|
)
|
|
expect(appVersionAtLeast('supabase-postgres-17.9.0.019', 'supabase-postgres-17.9.0.019')).toBe(
|
|
true
|
|
)
|
|
})
|
|
|
|
it('returns false when the version is below the threshold', () => {
|
|
expect(appVersionAtLeast('supabase-postgres-17.8.9.999', 'supabase-postgres-17.9.0.019')).toBe(
|
|
false
|
|
)
|
|
})
|
|
|
|
it('returns false for an unparseable version instead of throwing', () => {
|
|
expect(appVersionAtLeast('not-a-version', 'supabase-postgres-17.9.0.019')).toBe(false)
|
|
})
|
|
})
|
|
|
|
describe('isOrioleDbVersionAtLeast', () => {
|
|
it('returns true when the engine version is above the threshold', () => {
|
|
expect(
|
|
isOrioleDbVersionAtLeast(
|
|
'supabase-postgres-17.11.0.002-orioledb',
|
|
'supabase-postgres-17.11.0.001-orioledb'
|
|
)
|
|
).toBe(true)
|
|
expect(
|
|
isOrioleDbVersionAtLeast(
|
|
'supabase-postgres-17.12.0.001-orioledb',
|
|
'supabase-postgres-17.11.0.001-orioledb'
|
|
)
|
|
).toBe(true)
|
|
})
|
|
|
|
it('returns true when the engine version equals the threshold', () => {
|
|
expect(
|
|
isOrioleDbVersionAtLeast(
|
|
'supabase-postgres-17.11.0.001-orioledb',
|
|
'supabase-postgres-17.11.0.001-orioledb'
|
|
)
|
|
).toBe(true)
|
|
})
|
|
|
|
it('returns false when the engine version is below the threshold', () => {
|
|
expect(
|
|
isOrioleDbVersionAtLeast(
|
|
'supabase-postgres-17.10.9.999-orioledb',
|
|
'supabase-postgres-17.11.0.001-orioledb'
|
|
)
|
|
).toBe(false)
|
|
// wal-g (scheduled backup) support landed at 17.9.0.019, which is still
|
|
// below the Public Beta cutoff — these projects remain alpha.
|
|
expect(
|
|
isOrioleDbVersionAtLeast(
|
|
'supabase-postgres-17.9.0.019-orioledb',
|
|
'supabase-postgres-17.11.0.001-orioledb'
|
|
)
|
|
).toBe(false)
|
|
})
|
|
|
|
it('returns false for a non-OrioleDB dbVersion', () => {
|
|
expect(
|
|
isOrioleDbVersionAtLeast(
|
|
'supabase-postgres-17.11.0.001',
|
|
'supabase-postgres-17.11.0.001-orioledb'
|
|
)
|
|
).toBe(false)
|
|
})
|
|
|
|
it('returns false for undefined dbVersion', () => {
|
|
expect(isOrioleDbVersionAtLeast(undefined, 'supabase-postgres-17.11.0.001-orioledb')).toBe(
|
|
false
|
|
)
|
|
})
|
|
|
|
it('returns false for a non-OrioleDB threshold', () => {
|
|
expect(
|
|
isOrioleDbVersionAtLeast(
|
|
'supabase-postgres-17.11.0.001-orioledb',
|
|
'supabase-postgres-17.11.0.001'
|
|
)
|
|
).toBe(false)
|
|
})
|
|
})
|