Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ import {
} from '@aws/language-server-runtimes/server-interface'
import { TestFeatures } from '@aws/language-server-runtimes/testing'
import * as assert from 'assert'
import { createIterableResponse, setCredentialsForAmazonQTokenServiceManagerFactory } from '../../shared/testUtils'
import {
createIterableResponse,
setCredentialsForAmazonQTokenServiceManagerFactory,
setIamCredentialsForAmazonQServiceManagerFactory,
} from '../../shared/testUtils'
import sinon from 'ts-sinon'
import { AgenticChatController } from './agenticChatController'
import { ChatSessionManagementService } from '../chat/chatSessionManagementService'
Expand Down Expand Up @@ -179,7 +183,8 @@ describe('AgenticChatController', () => {
let getMessagesStub: sinon.SinonStub
let addMessageStub: sinon.SinonStub

const setCredentials = setCredentialsForAmazonQTokenServiceManagerFactory(() => testFeatures)
const setSsoCredentials = setCredentialsForAmazonQTokenServiceManagerFactory(() => testFeatures)
const setIamCredentials = setIamCredentialsForAmazonQServiceManagerFactory(() => testFeatures)

beforeEach(() => {
// Override the response timeout for tests to avoid long waits
Expand Down Expand Up @@ -272,7 +277,7 @@ describe('AgenticChatController', () => {
}
testFeatures.lsp.window.showDocument = sinon.stub()
testFeatures.setClientParams(cachedInitializeParams)
setCredentials('builderId')
setSsoCredentials('builderId')

activeTabSpy = sinon.spy(ChatTelemetryController.prototype, 'activeTabId', ['get', 'set'])
removeConversationSpy = sinon.spy(ChatTelemetryController.prototype, 'removeConversation')
Expand Down Expand Up @@ -3144,6 +3149,9 @@ ${' '.repeat(8)}}
// Reset the singleton instance
ChatSessionManagementService.reset()

// Store IAM credentials
setIamCredentials()

// Create IAM service manager
AmazonQIAMServiceManager.resetInstance()
iamServiceManager = AmazonQIAMServiceManager.initInstance(testFeatures)
Expand Down
Loading