mirror of https://github.com/buster-so/buster.git
increase timeouts and a few lint fixes
This commit is contained in:
parent
0feb690bbe
commit
64992930a4
|
@ -15,11 +15,13 @@ pub async fn get_redshift_connection(credentials: &RedshiftCredentials) -> Resul
|
|||
.username(credentials.username.as_str())
|
||||
.password(credentials.password.as_str())
|
||||
.database(&credentials.default_database)
|
||||
.extra_float_digits(2);
|
||||
.extra_float_digits(2)
|
||||
.connect_timeout(Duration::from_secs(60)); // 60 second connection timeout
|
||||
|
||||
let redshift_pool = match PgPoolOptions::new()
|
||||
.max_connections(1)
|
||||
.acquire_timeout(Duration::from_secs(5))
|
||||
.acquire_timeout(Duration::from_secs(60)) // 60 second acquire timeout
|
||||
.connect_timeout(Duration::from_secs(60)) // 60 second pool connection timeout
|
||||
.connect_with(options)
|
||||
.await
|
||||
{
|
||||
|
|
|
@ -42,10 +42,7 @@ describe('delete-files-tool', () => {
|
|||
|
||||
it('should validate input schema correctly', () => {
|
||||
const validInput = {
|
||||
files: [
|
||||
{ path: '/test/file1.txt' },
|
||||
{ path: '/test/file2.txt' },
|
||||
],
|
||||
files: [{ path: '/test/file1.txt' }, { path: '/test/file2.txt' }],
|
||||
};
|
||||
|
||||
expect(() => deleteFiles.inputSchema.parse(validInput)).not.toThrow();
|
||||
|
@ -53,9 +50,7 @@ describe('delete-files-tool', () => {
|
|||
|
||||
it('should reject invalid input schema', () => {
|
||||
const invalidInput = {
|
||||
files: [
|
||||
{ },
|
||||
],
|
||||
files: [{}],
|
||||
};
|
||||
|
||||
expect(() => deleteFiles.inputSchema.parse(invalidInput)).toThrow();
|
||||
|
@ -142,10 +137,7 @@ describe('delete-files-tool', () => {
|
|||
|
||||
it('should handle mixed success and error results', async () => {
|
||||
const input = {
|
||||
files: [
|
||||
{ path: '/test/file1.txt' },
|
||||
{ path: '/test/file2.txt' },
|
||||
],
|
||||
files: [{ path: '/test/file1.txt' }, { path: '/test/file2.txt' }],
|
||||
};
|
||||
|
||||
const mockLocalResult = [
|
||||
|
@ -161,10 +153,12 @@ describe('delete-files-tool', () => {
|
|||
});
|
||||
|
||||
expect(result.successes).toEqual(['/test/file1.txt']);
|
||||
expect(result.failures).toEqual([{
|
||||
path: '/test/file2.txt',
|
||||
error: 'Permission denied',
|
||||
}]);
|
||||
expect(result.failures).toEqual([
|
||||
{
|
||||
path: '/test/file2.txt',
|
||||
error: 'Permission denied',
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('should handle empty files array', async () => {
|
||||
|
|
|
@ -6,11 +6,13 @@ import { z } from 'zod';
|
|||
import { type SandboxContext, SandboxContextKey } from '../../../context/sandbox-context';
|
||||
|
||||
const deleteFilesInputSchema = z.object({
|
||||
files: z.array(
|
||||
z.object({
|
||||
path: z.string().describe('File path to delete (absolute or relative)'),
|
||||
})
|
||||
).describe('Array of file deletion operations to perform'),
|
||||
files: z
|
||||
.array(
|
||||
z.object({
|
||||
path: z.string().describe('File path to delete (absolute or relative)'),
|
||||
})
|
||||
)
|
||||
.describe('Array of file deletion operations to perform'),
|
||||
});
|
||||
|
||||
const deleteFilesOutputSchema = z.object({
|
||||
|
|
|
@ -47,6 +47,7 @@ describe('RedshiftAdapter', () => {
|
|||
user: 'testuser',
|
||||
password: 'testpass',
|
||||
ssl: true,
|
||||
connectionTimeoutMillis: 60000,
|
||||
});
|
||||
expect(mockClient.connect).toHaveBeenCalled();
|
||||
});
|
||||
|
|
|
@ -40,10 +40,8 @@ export class RedshiftAdapter extends BaseAdapter {
|
|||
ssl: redshiftCredentials.ssl ?? true, // SSL is typically required for Redshift
|
||||
};
|
||||
|
||||
// Handle connection timeout
|
||||
if (redshiftCredentials.connection_timeout) {
|
||||
config.connectionTimeoutMillis = redshiftCredentials.connection_timeout;
|
||||
}
|
||||
// Handle connection timeout - default to 60 seconds for serverless
|
||||
config.connectionTimeoutMillis = redshiftCredentials.connection_timeout || 60000;
|
||||
|
||||
// Set default schema if provided
|
||||
if (redshiftCredentials.schema) {
|
||||
|
|
Loading…
Reference in New Issue