feat(backup): add MinIO snapshot backups via CLI and scheduler
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { backupInternals } from './run.js';
|
||||
|
||||
describe('backup internals', () => {
|
||||
it('builds minio host URL with protocol and encoded credentials', () => {
|
||||
const host = backupInternals.buildMinioHost({
|
||||
endpoint: 'localhost:9000',
|
||||
accessKey: 'minio-admin',
|
||||
secretKey: 's3cr3t/with:chars',
|
||||
secure: false,
|
||||
});
|
||||
|
||||
expect(host).toBe('http://minio-admin:s3cr3t%2Fwith%3Achars@localhost:9000');
|
||||
});
|
||||
|
||||
it('builds object key from prefix and file name', () => {
|
||||
expect(backupInternals.buildObjectKey('flynn/daily', 'a.tar.gz')).toBe('flynn/daily/a.tar.gz');
|
||||
expect(backupInternals.buildObjectKey('/flynn/daily/', 'a.tar.gz')).toBe('flynn/daily/a.tar.gz');
|
||||
expect(backupInternals.buildObjectKey('', 'a.tar.gz')).toBe('a.tar.gz');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user