-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(server): add dep to opensearch client * feature(server): introduce opensearch data-export * chore(module): set module name to lowercase * test(module): update name * test(module): update name * chore(module): clean new output bundles correctly * feature(server): add export ending log * feature(server): add export starting log * doc(README): update documentation for data export * doc(TODO/FIXME): update lists * doc(README): add opensearch graph * doc(README): fix CI branch * doc(TODO): update list * chore(eslint): enable singlequotes rule * chore(eslint): fix warnings * refactor(helper): clean exporter code up * doc(TODO/FIXME): update contents * refactor(helper): typo * test(helper): add unit tests * test(helper): attempts to fix date UTs * refactor(helper): attempts to build TZ independent dates * refactor(scripts): remove deprecated data exporter script * doc(TODO/FIXME): update lists * chore(release): update release version
- Loading branch information
Showing
26 changed files
with
586 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/client/hooks/with-notifications/notification-catcher.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/server/processing/teleinfo/data-export/helpers/opensearch-client.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Client } from '@opensearch-project/opensearch'; | ||
import { createOpenSearchClient } from './opensearch-client'; | ||
|
||
import type { OpensearchConfiguration } from '../../../../../shared/domain/teleinfo-config'; | ||
|
||
jest.mock('@opensearch-project/opensearch'); | ||
const opensearchClientMock = Client as jest.Mock; | ||
|
||
describe('Opensearch client helper functions', () => { | ||
describe('createOpenSearchClient function', () => { | ||
beforeEach(() => { | ||
opensearchClientMock.mockReset(); | ||
}); | ||
|
||
it('should return an initialized client', () => { | ||
// given | ||
const config: OpensearchConfiguration = { | ||
indexName: '', | ||
instance: 'http://osinstance:9200', | ||
user: 'USER', | ||
password: 'PASS' | ||
}; | ||
|
||
// when | ||
const actualClient = createOpenSearchClient(config); | ||
|
||
// then | ||
expect(actualClient).not.toBeUndefined(); | ||
expect(opensearchClientMock).toHaveBeenCalledWith({ | ||
node: 'http://USER:PASS@osinstance:9200', | ||
ssl: { | ||
rejectUnauthorized: false, | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); |
16 changes: 16 additions & 0 deletions
16
src/server/processing/teleinfo/data-export/helpers/opensearch-client.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Client } from '@opensearch-project/opensearch'; | ||
import { OpensearchConfiguration } from '../../../../../shared/domain/teleinfo-config'; | ||
|
||
export function createOpenSearchClient(config: OpensearchConfiguration) { | ||
const { instance, user, password } = config; | ||
const instanceURL = new URL(instance); | ||
|
||
// Create a client with SSL/TLS enabled. | ||
const client = new Client({ | ||
node: `${instanceURL.protocol}//${user}:${password}@${instanceURL.hostname}:${instanceURL.port}`, | ||
ssl: { | ||
rejectUnauthorized: false, | ||
}, | ||
}); | ||
return client; | ||
} |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.