Skip to content

Commit

Permalink
Refactor connection generation and remove unused script
Browse files Browse the repository at this point in the history
  • Loading branch information
mabaasit committed Dec 19, 2023
1 parent b38b1d6 commit 4a1f42e
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 77 deletions.
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,4 @@ lib
**/*.js.map
!**/initdb/*.js
!.eslintrc.js
!scripts/generate-connections.js
*.tgz


# Ignore the generated connections
compass-connections.json
72 changes: 0 additions & 72 deletions scripts/generate-connections.js

This file was deleted.

55 changes: 55 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { v4 } from 'uuid';
import TestEnvironment from './test-environment';
import TestEnvironments from './test-environments';
import { TestEnvironmentConfiguration } from './test-environment-configuration';
Expand Down Expand Up @@ -36,3 +37,57 @@ export default function createTestEnvironments(

return new TestEnvironments(envs);
}

const connectionsWithVariants = {
enterprise: ['enterprise'],
ldap: ['ldap'],
scram: [
'scramReadWriteAnyDatabase',
'scramReadWriteAnyDatabaseScramSha1',
'scramReadWriteAnyDatabaseScramSha256',
'scramOnlyScramSha1',
'scramOnlyScramSha256',
'scramEncodedPassword',
'scramPrivilegesOnNonExistingDatabases',
'scramPrivilegesOnNonExistingCollections',
'scramAlternateAuthDb',
],
sharded: ['sharded'],
ssh: [
'sshPassword',
'sshIdentityKey',
'sshIdentityKeyWithPassphrase',
'sshReplicaSetSeedlist',
'sshReplicaSetByReplSetName',
],
tls: [
'tlsUnvalidated',
'tlsServerValidation',
'tlsServerValidationSsh',
'tlsServerAndClientValidation',
'tlsServerAndClientValidationKeyCrt',
'tlsX509',
'tlsX509WithSsh',
],
kerberos: ['kerberos', 'kerberosAlternate', 'kerberosCrossRealm'],
};

/**
* @returns The list of test connections that are compatible with the docker configurations.
*/
export function getTestConnections() {

Check warning on line 78 in src/index.ts

View workflow job for this annotation

GitHub Actions / Check and Test

Missing return type on function
const connections = [];
for (const [env, variants] of Object.entries(connectionsWithVariants)) {
const envConnections = createTestEnvironments([env]);
for (const variant of variants) {
connections.push({
id: v4(),
favorite: {
name: variant,
},
connectionOptions: envConnections.getConnectionOptions(variant),
});
}
}
return connections;
}

0 comments on commit 4a1f42e

Please sign in to comment.