Skip to content

Commit

Permalink
Address linter issues in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
oleiade committed Nov 17, 2023
1 parent 6a07c52 commit 009b47b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 16 deletions.
17 changes: 5 additions & 12 deletions examples/kinesis.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import exec from 'k6/execution'

import { AWSConfig, KinesisClient } from '../build/kinesis.js'
import encoding from 'k6/encoding'
import { describe, expect } from 'https://jslib.k6.io/k6chaijs/4.3.4.2/index.js'
import { fail } from 'k6'

const dummyStream = `kinesis-test-stream-provisioned`
Expand All @@ -16,11 +13,6 @@ const awsConfig = new AWSConfig({

const kinesis = new KinesisClient(awsConfig)

const getShardIterator = async (shardId) => {
const res = await kinesis.getShardIterator(dummyStream, shardId, `TRIM_HORIZON`)
return res.ShardIterator
}

export default async function () {
// List the streamds the AWS authentication configuration
// gives us access to.
Expand All @@ -39,7 +31,7 @@ export default async function () {
})

// Put some records in it
const records = await kinesis.putRecords({
await kinesis.putRecords({
StreamName: dummyStream,
Records: [
{
Expand All @@ -58,14 +50,15 @@ export default async function () {

// For each shard, read all the data
shards.map(async (shard) => {
const iterator = await kinesis.getShardIterator(dummyStream, shardId, `TRIM_HORIZON`)
let iterator = await kinesis.getShardIterator(dummyStream, shard.id, `TRIM_HORIZON`)

while (true) {
let shouldBreak = false;
while (!shouldBreak) {
const res = await kinesis.getRecords({ ShardIterator: iterator })
iterator = res.NextShardIterator

if (!res.MillisBehindLatest || res.MillisBehindLatest == `0`) {
break
shouldBreak = true
}
}
})
Expand Down
2 changes: 1 addition & 1 deletion examples/s3-multipart.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ export default async function () {
])

// Let's redownload it verify it's correct, and delete it
const obj = await s3.getObject(testBucketName, testFileKey)
await s3.getObject(testBucketName, testFileKey)
await s3.deleteObject(testBucketName, testFileKey)
}
2 changes: 1 addition & 1 deletion examples/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ export default async function () {
}

// Let's redownload it, verify it's correct, and delete it
const obj = await s3.getObject(testBucketName, testFileKey)
await s3.getObject(testBucketName, testFileKey)
await s3.deleteObject(testBucketName, testFileKey)
}
2 changes: 1 addition & 1 deletion examples/secrets-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default async function () {

// Now that we know the secret exist, let's update its value
const newTestSecretValue = 'new-test-value'
const u = await secretsManager.putSecretValue(testSecretName, newTestSecretValue)
await secretsManager.putSecretValue(testSecretName, newTestSecretValue)

// Let's get its value and verify it was indeed updated
const updatedSecret = await secretsManager.getSecret(testSecretName)
Expand Down
1 change: 0 additions & 1 deletion examples/signature-presign.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
AWSConfig,
SignatureV4,
AMZ_CONTENT_SHA256_HEADER,
UNSIGNED_PAYLOAD,
} from '../build/aws.js'

const awsConfig = new AWSConfig({
Expand Down

0 comments on commit 009b47b

Please sign in to comment.