Skip to content

Re enable gen test #1132

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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 @@ -1391,8 +1391,8 @@ const debug = sdkVersion.endsWith('-debug');
});
routes.set('/kv-store-options/gen', async () => {
let store = new KVStore(KV_STORE_NAME);
let key = `entry-options`;
await store.put(key, 'body op', {
let key = `entry-options-gen`;
await store.put(key, 'body gen', {
gen: 2,
});
let entry = await store.get(key);
Expand All @@ -1403,7 +1403,7 @@ const debug = sdkVersion.endsWith('-debug');
`entry.options instanceof ReadableStream`,
);
let text = await streamToString(result);
strictEqual(text, 'body op', `entry.body contents as string`);
strictEqual(text, 'body gen', `entry.body contents as string`);
});
routes.set('/kv-store-options/gen-invalid', async () => {
await assertRejects(
Expand All @@ -1413,7 +1413,7 @@ const debug = sdkVersion.endsWith('-debug');
await store.put(key, 'body Nan', { gen: '2' });
},
TypeError,
`KVStore.insert: gen must be an integer`,
`KVStore.put: gen must be an integer`,
);
});
routes.set('/kv-store-entry/body', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@
"GET /kv-store-entry/json/invalid": { "flake": true },
"GET /kv-store-entry/arrayBuffer/valid": { "flake": true },
"GET /kv-store-options/gen": {
"skip": true,
"flake": true
},
"GET /kv-store-options/gen-invalid": { "flake": true },
Expand Down
4 changes: 3 additions & 1 deletion integration-tests/js-compute/teardown.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ async function removeConfigStores() {
await zx`fastly resource-link delete --version latest --autoclone --id=${LINK_ID} --token $FASTLY_API_TOKEN`;
await zx`fastly service-version activate --version latest --token $FASTLY_API_TOKEN`;
}
await zx`fastly config-store delete --store-id=${STORE_ID} --token $FASTLY_API_TOKEN`;
try {
await zx`fastly config-store delete --store-id=${STORE_ID} --token $FASTLY_API_TOKEN`;
} catch {}
}

STORE_ID = existingListId(stores, CONFIG_STORE_NAME);
Expand Down
4 changes: 2 additions & 2 deletions runtime/fastly/builtins/kv-store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ bool KVStore::put(JSContext *cx, unsigned argc, JS::Value *vp) {
}
}
if (!if_gen.has_value()) {
api::throw_error(cx, api::Errors::TypeError, "KVStore.insert", "gen", "be an integer");
api::throw_error(cx, api::Errors::TypeError, "KVStore.put", "gen", "be an integer");
return ReturnPromiseRejectedWithPendingError(cx, args);
}
}
Expand Down Expand Up @@ -564,7 +564,7 @@ bool KVStore::put(JSContext *cx, unsigned argc, JS::Value *vp) {
}
}

auto res = kv_store(self).insert(key_chars, body, mode, std::nullopt, metadata, ttl);
auto res = kv_store(self).insert(key_chars, body, mode, if_gen, metadata, ttl);
if (auto *err = res.to_err()) {
HANDLE_ERROR(cx, *err);
return ReturnPromiseRejectedWithPendingError(cx, args);
Expand Down
Loading