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

test(middleware-sdk-sqs): use mock credentials in integ test #5954

Merged
merged 1 commit into from
Apr 2, 2024
Merged
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
@@ -1,5 +1,6 @@
import { SQS } from "@aws-sdk/client-sqs";
import { HttpHandler, HttpResponse } from "@smithy/protocol-http";
import type { AwsCredentialIdentity } from "@smithy/types";
import crypto from "crypto";
import { Readable } from "stream";

Expand Down Expand Up @@ -103,6 +104,11 @@ const handlerResponse = (body: string) => {
};

describe("middleware-sdk-sqs", () => {
const mockCredentials: AwsCredentialIdentity = {
accessKeyId: "integration_test",
secretAccessKey: "integration_test",
};

describe(SQS.name + ` w/ useAwsQuery: ${useAwsQuery}`, () => {
describe("correct md5 hashes", () => {
beforeEach(() => {
Expand All @@ -112,6 +118,7 @@ describe("middleware-sdk-sqs", () => {
it("runs md5 checksums on received messages", async () => {
const client = new SQS({
region: "us-west-2",
credentials: mockCredentials,
requestHandler: new (class implements HttpHandler {
async handle(): Promise<any> {
const r = responses();
Expand All @@ -134,6 +141,7 @@ describe("middleware-sdk-sqs", () => {
it("runs md5 checksums on sent messages", async () => {
const client = new SQS({
region: "us-west-2",
credentials: mockCredentials,
requestHandler: new (class implements HttpHandler {
async handle(): Promise<any> {
const r = responses();
Expand All @@ -157,6 +165,7 @@ describe("middleware-sdk-sqs", () => {
it("runs md5 checksums on batch sent messages", async () => {
const client = new SQS({
region: "us-west-2",
credentials: mockCredentials,
requestHandler: new (class implements HttpHandler {
async handle(): Promise<any> {
const r = responses();
Expand Down Expand Up @@ -199,6 +208,7 @@ describe("middleware-sdk-sqs", () => {
it("runs md5 checksums on received messages", async () => {
const client = new SQS({
region: "us-west-2",
credentials: mockCredentials,
requestHandler: new (class implements HttpHandler {
async handle(): Promise<any> {
const r = responses();
Expand All @@ -224,6 +234,8 @@ describe("middleware-sdk-sqs", () => {

it("runs md5 checksums on sent messages", async () => {
const client = new SQS({
region: "us-west-2",
credentials: mockCredentials,
requestHandler: new (class implements HttpHandler {
async handle(): Promise<any> {
const r = responses();
Expand Down Expand Up @@ -251,6 +263,7 @@ describe("middleware-sdk-sqs", () => {
it("runs md5 checksums on batch sent messages", async () => {
const client = new SQS({
region: "us-west-2",
credentials: mockCredentials,
requestHandler: new (class implements HttpHandler {
async handle(): Promise<any> {
const r = responses();
Expand Down Expand Up @@ -294,6 +307,7 @@ describe("middleware-sdk-sqs", () => {
it("should override resolved endpoint by default", async () => {
const client = new SQS({
region: "us-west-2",
credentials: mockCredentials,
});

requireRequestsFrom(client).toMatch({
Expand All @@ -311,6 +325,7 @@ describe("middleware-sdk-sqs", () => {
it("does not override endpoint if shut off with useQueueUrlAsEndpoint=false", async () => {
const client = new SQS({
region: "us-west-2",
credentials: mockCredentials,
useQueueUrlAsEndpoint: false,
});

Expand All @@ -329,6 +344,7 @@ describe("middleware-sdk-sqs", () => {
it("does not override endpoint if custom endpoint given to client", async () => {
const client = new SQS({
region: "us-west-2",
credentials: mockCredentials,
endpoint: "https://custom-endpoint.com/",
});

Expand Down
Loading