All files / test/blong-int-adapter/blob server.ts

100% Statements 58/58
100% Branches 2/2
100% Functions 1/1
100% Lines 58/58

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 591x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
import {realm} from '@feasibleone/blong';
 
/** Where the harness's MinIO answers; the CI node port is 30009 and the local one is 9000. */
const ENDPOINT = process.env['S3_ENDPOINT'] ?? 'http://localhost:9000';
 
/**
 * The blob realm against a real bucket.
 *
 * A realm of its own rather than a group inside `s3/`: both the raw adapter and the store answer the one
 * namespace `storage` (@@D-849), so a process carrying both would have two ports claiming every
 * `storage.blob.*` call and the one that did not hold the group would answer it as an unknown object
 * operation. One store per run keeps that from happening by construction.
 *
 * The blob realm keeps no group of its own for this: its tests must stay runnable on a laptop with no
 * service, so the proof that the store works over the wire belongs here.
 */
export default realm(blong => ({
    url: import.meta.url,
    validation: blong.type.Object({}),
    children: [
        './test',
        async function blob() {
            return import('@feasibleone/blong-blob/server.ts');
        },
    ],
    config: {
        default: {},
        microservice: {
            adapter: true,
        },
        'adapter.blob': {
            adapter: true,
            test: true,
            blob: {
                // The object store is the backend this run exists for; the filesystem one is skipped the
                // way a deployment that wants S3 skips it.
                store: false as const,
                s3Store: {
                    namespaces: {test: {}},
                    prefix: 'int-adapter',
                    bucket: {Bucket: 'blong-integration'},
                    s3: {
                        region: 'us-east-1',
                        endpoint: ENDPOINT,
                        credentials: {accessKeyId: 'blong-admin', secretAccessKey: 'password'},
                        forcePathStyle: true,
                    },
                },
                blobDispatch: {
                    crypto: {
                        key: '00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff',
                    },
                    cookie: {secret: 'int-adapter-cookie-secret', ttl: 600},
                },
            },
        },
    },
}));