Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump consul from 1.2.0 to 2.0.1 #1848

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"dependencies": {
"@open-amt-cloud-toolkit/wsman-messages": "^5.6.10",
"body-parser": "^1.20.2",
"consul": "^1.2.0",
"consul": "^2.0.1",
"cors": "^2.8.5",
"crypto-random-string": "^3.3.1",
"exponential-backoff": "^3.1.1",
Expand Down
2 changes: 1 addition & 1 deletion src/Index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const startItUp = (): void => {
}

export async function setupServiceManager(config: RPSConfig): Promise<void> {
const consul: IServiceManager = new ConsulService(config.consul_host, config.consul_port)
const consul: IServiceManager = new ConsulService(config.consul_host, parseInt(config.consul_port, 10))
await waitForServiceManager(consul, 'consul')
await processServiceConfigs(consul, config)
}
Expand Down
4 changes: 2 additions & 2 deletions src/consulService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let serviceName: string
let consul: ConsulService
describe('consul', () => {
beforeEach(() => {
consul = new ConsulService('localhost', '8500')
consul = new ConsulService('localhost', 8500)

jest.clearAllMocks()
jest.restoreAllMocks()
Expand Down Expand Up @@ -41,7 +41,7 @@ describe('consul', () => {
expect(consul.consul.kv.set).toHaveBeenCalledWith(componentName + '/config', JSON.stringify(config, null, 2))
})
it('seed Consul failure', async () => {
consul.consul.kv.set = spyOn(consul.consul.kv, 'set').mockResolvedValue(Promise.reject(new Error())) as any
consul.consul.kv.set = spyOn(consul.consul.kv, 'set').mockRejectedValue(new Error()) as any
const result = await consul.seed(componentName, config)
expect(result).toBe(false)
})
Expand Down
4 changes: 2 additions & 2 deletions src/consulService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import type { IServiceManager } from './interfaces/IServiceManager.js'
import { Environment } from './utils/Environment.js'

export class ConsulService implements IServiceManager {
consul: Consul.Consul
consul: Consul
log = new Logger('ConsulService')
constructor(host: string, port: string) {
constructor(host: string, port: number) {
this.consul = new Consul({
host,
port,
Expand Down
2 changes: 1 addition & 1 deletion src/serviceManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { jest } from '@jest/globals'

const { processServiceConfigs, waitForServiceManager } = await import('./serviceManager.js')

const consul: IServiceManager = new ConsulService('consul', '8500')
const consul: IServiceManager = new ConsulService('consul', 8500)
let componentName: string
let config: any

Expand Down
Loading