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

[FEAT] object store compatibility test #555

Draft
wants to merge 71 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
cf5b83a
Corrected a typo
y2k4life Jul 22, 2023
4c215f1
Fixed bug in code example
y2k4life Jul 22, 2023
dc1cda3
Merge pull request #559 from y2k4life/patch-2
aricart Jul 26, 2023
54e4791
Merge pull request #558 from y2k4life/patch-1
aricart Jul 27, 2023
f0f7e1d
Merge pull request #567 from nats-io/dev
aricart Aug 16, 2023
42c3dcc
[DOC] update online docs
aricart Aug 17, 2023
aefe58b
Add issue forms
bruth Aug 21, 2023
910ca40
Fix discussions link
bruth Aug 22, 2023
e58f0c1
[TEST] removed user and taken auth test, as this is now possible.
aricart Aug 22, 2023
4513641
Merge pull request #571 from nats-io/fix-test
aricart Aug 22, 2023
fce965e
Merge pull request #570 from nats-io/add-issue-forms
aricart Aug 22, 2023
e9333bc
[FIX] removed empty files that were left behind after jetstream refac…
aricart Aug 22, 2023
e6edb18
[FIX] added JetStreamSubscriptionInfoable to types, as it was needed …
aricart Aug 23, 2023
447b309
Merge pull request #572 from nats-io/remove-empty
aricart Aug 23, 2023
b4e6de0
[FEAT] added support for specifying whether the watcher should receiv…
aricart Aug 23, 2023
c85f1ce
[FIX] remove rogue node import from cluster tool
aricart Aug 23, 2023
0bcfdb1
Merge pull request #578 from nats-io/fix-cluster
aricart Aug 23, 2023
4bdba1c
Merge pull request #576 from nats-io/sub-infoable
aricart Aug 24, 2023
4c484ec
Merge pull request #569 from nats-io/doc
aricart Aug 24, 2023
06c37f0
Merge pull request #577 from nats-io/fix-573
aricart Aug 24, 2023
082ac20
Fix PullConsumerMessagesImpl not respecting inboxPrefix
oscarwcl Aug 28, 2023
5cab8ac
Merge pull request #580 from oscarwcl/js-consumer-inbox-prefix
aricart Aug 28, 2023
1d168e3
[TEST] Added tests for #580
aricart Aug 28, 2023
b8e48ee
Merge pull request #581 from nats-io/consumer-inbox-tests
aricart Aug 28, 2023
a3f4700
[BUMP] deno to 1.36.3 and std@0.200.0
aricart Aug 28, 2023
225b851
[FMT] markdown format
aricart Aug 28, 2023
0be80dc
[LINT] changed to asserts/mod.ts as testing/asserts.ts is deprecated
aricart Aug 28, 2023
8e5efab
removed unused assert
aricart Aug 28, 2023
891cf13
experimental bundler
aricart Aug 28, 2023
e8fc406
Merge pull request #583 from nats-io/bundler
aricart Aug 29, 2023
311382d
Merge pull request #582 from nats-io/bump-deno
aricart Aug 29, 2023
287a5ee
- added space, tabs, newlines, carriage returns to the list of reject…
aricart Sep 6, 2023
5c83e97
- added space, tabs, newlines, carriage returns to the list of reject…
aricart Sep 6, 2023
db88524
Merge pull request #585 from nats-io/fix-584
aricart Sep 6, 2023
02a19e4
[FEAT] implements support for `subject_transforms` on StreamSources/M…
aricart Sep 14, 2023
2263161
[FEAT] allow micro to specify a queue name - this allows the same ser…
aricart Sep 15, 2023
79e017e
simplified tests
aricart Sep 15, 2023
05b4bd7
Merge pull request #589 from nats-io/fix-588
aricart Sep 16, 2023
7bd09ac
[FEAT] queue option can now be specified at the service, group or end…
aricart Sep 18, 2023
62cb430
Merge pull request #590 from nats-io/micro-queue
aricart Sep 19, 2023
a77bab0
[CHANGE] remove `subject_transform_dest` from `StreamSource` and `Str…
aricart Sep 19, 2023
285b783
[DOC] grammar
aricart Sep 19, 2023
6140b7f
Merge pull request #592 from nats-io/remove-subject-transform-dest
aricart Sep 19, 2023
d023380
Merge pull request #593 from nats-io/doc-cleanup
aricart Sep 19, 2023
74de87a
[FEAT] stream configurations now have `compression` option - this is …
aricart Sep 19, 2023
7b050d0
Merge pull request #595 from nats-io/fix-594
aricart Sep 19, 2023
02eac68
[JETSTREAM] [OS] [CHANGE] the `update()` method will now delete the p…
aricart Sep 20, 2023
c8af71f
[FEAT] [JETSTREAM] added support for `consumer_limits` on stream crea…
aricart Sep 20, 2023
72cd3e5
tests
aricart Sep 20, 2023
203290c
Merge pull request #597 from nats-io/consumer-limits
aricart Sep 20, 2023
7707f9c
Merge pull request #596 from nats-io/os-link-updates
aricart Sep 20, 2023
cdc3537
[FIX] linter warnings
aricart Sep 20, 2023
dd2c1a7
Merge pull request #598 from nats-io/linter
aricart Sep 20, 2023
f9c5039
[CI] updated deno to 1.36.4 and nats-server to 2.10.1
aricart Sep 20, 2023
ecdef4f
Merge pull request #599 from nats-io/ci-updates
aricart Sep 20, 2023
306ea1e
[BUMP] client version
aricart Sep 20, 2023
5d15adc
Merge pull request #600 from nats-io/bump-version
aricart Sep 20, 2023
f50b52c
[FEAT] added a utility function syncIterator() to wrap an AsyncIterab…
aricart Sep 29, 2023
8524c4f
added more tests
aricart Sep 29, 2023
5ac8d3b
[DOC] regenerated docs
aricart Sep 29, 2023
818cfa9
Merge pull request #603 from nats-io/docs
aricart Sep 29, 2023
b0f16b0
Merge pull request #602 from nats-io/sync-sub
aricart Oct 3, 2023
25b9d45
[FEAT] object store compatibility test
aricart Jun 30, 2023
4a02a9d
Improve object store test
Jarema Jul 1, 2023
f8155db
Fixed default and custom bucket test
Jarema Sep 28, 2023
dd3b5b5
Add object tests
Jarema Sep 29, 2023
60590d5
Fix check for object store options
Jarema Oct 4, 2023
a9c2143
Add bucket name to link object
Jarema Oct 4, 2023
03f44da
Complete Object store compatibility tests
Jarema Oct 4, 2023
ade4f12
Apply fmt
Jarema Oct 4, 2023
caf5025
Fix linting
Jarema Oct 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Discussion
url: https://github.com/nats-io/nats.deno/discussions
about: Ideal for ideas, feedback, or longer form questions.
- name: Chat
url: https://slack.nats.io
about: Ideal for short, one-off questions, general conversation, and meeting other NATS users!
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/defect.yml
@@ -0,0 +1,41 @@
---
name: Defect
description: Report a defect, such as a bug or regression.
labels:
- defect
body:
- type: textarea
id: versions
attributes:
label: What version were you using?
description: Include the server version (`nats-server --version`) and any client versions when observing the issue.
validations:
required: true
- type: textarea
id: environment
attributes:
label: What environment was the server running in?
description: This pertains to the operating system, CPU architecture, and/or Docker image that was used.
validations:
required: true
- type: textarea
id: steps
attributes:
label: Is this defect reproducible?
description: Provide best-effort steps to showcase the defect.
validations:
required: true
- type: textarea
id: expected
attributes:
label: Given the capability you are leveraging, describe your expectation?
description: This may be the expected behavior or performance characteristics.
validations:
required: true
- type: textarea
id: actual
attributes:
label: Given the expectation, what is the defect you are observing?
description: This may be an unexpected behavior or regression in performance.
validations:
required: true
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/proposal.yml
@@ -0,0 +1,34 @@
---
name: Proposal
description: Propose an enhancement or new feature.
labels:
- proposal
body:
- type: textarea
id: usecase
attributes:
label: What motivated this proposal?
description: Describe the use case justifying this request.
validations:
required: true
- type: textarea
id: change
attributes:
label: What is the proposed change?
description: This could be a behavior change, enhanced API, or a branch new feature.
validations:
required: true
- type: textarea
id: benefits
attributes:
label: Who benefits from this change?
description: Describe how this not only benefits you.
validations:
required: false
- type: textarea
id: alternates
attributes:
label: What alternatives have you evaluated?
description: This could be using existing features or relying on an external dependency.
validations:
required: false
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Expand Up @@ -16,7 +16,7 @@ jobs:
environment: CI
strategy:
matrix:
deno-version: [1.36.1]
deno-version: [1.36.4]

steps:
- name: Git Checkout Deno Module
Expand All @@ -30,7 +30,7 @@ jobs:
deno-version: ${{ matrix.deno-version }}

- name: Set NATS Server Version
run: echo "NATS_VERSION=v2.9.21" >> $GITHUB_ENV
run: echo "NATS_VERSION=v2.10.1" >> $GITHUB_ENV

# this here because dns seems to be wedged on gha
# - name: Add hosts to /etc/hosts
Expand Down
58 changes: 58 additions & 0 deletions bin/bundle.ts
@@ -0,0 +1,58 @@
/*
* Copyright 2023 The NATS Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { cli } from "https://deno.land/x/cobra@v0.0.9/mod.ts";
import { bundle } from "https://deno.land/x/emit@0.26.0/mod.ts";

const root = cli({
use: "bundle javascript/typescript",
run: async (_cmd, _args, flags) => {
const src = flags.value<string>("src");
const out = flags.value<string>("out");
const type = flags.value<boolean>("module") ? "module" : "classic";
try {
const r = URL.canParse(src)
? await bundle(new URL(src), { type })
: await bundle(src, { type });
await Deno.writeTextFile(out, r.code);
console.log(`wrote ${out}`);
return 0;
} catch (err) {
console.log(`failed to bundle: ${err.message}`);
console.log(err.stack);
return 1;
}
},
});

root.addFlag({
name: "src",
type: "string",
usage: "input module source path",
required: true,
});
root.addFlag({
name: "out",
type: "string",
usage: "output bundle path",
required: true,
});
root.addFlag({
name: "module",
type: "boolean",
usage: "output esm module (default)",
default: true,
});

Deno.exit(await root.execute(Deno.args));
4 changes: 2 additions & 2 deletions bin/exports.ts
Expand Up @@ -13,13 +13,13 @@
* limitations under the License.
*/

import { parse } from "https://deno.land/std@0.190.0/flags/mod.ts";
import { parse } from "https://deno.land/std@0.200.0/flags/mod.ts";
import {
basename,
extname,
join,
resolve,
} from "https://deno.land/std@0.190.0/path/mod.ts";
} from "https://deno.land/std@0.200.0/path/mod.ts";

const argv = parse(
Deno.args,
Expand Down
2 changes: 1 addition & 1 deletion bin/fix-os.ts
Expand Up @@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { parse } from "https://deno.land/std@0.190.0/flags/mod.ts";
import { parse } from "https://deno.land/std@0.200.0/flags/mod.ts";
import { ObjectStoreImpl, ServerObjectInfo } from "../jetstream/objectstore.ts";
import {
connect,
Expand Down
207 changes: 207 additions & 0 deletions bin/os_compatibility.ts
@@ -0,0 +1,207 @@
/*
* Copyright 2023 The NATS Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { connect, millis, Msg } from "../src/mod.ts";
import { sha256 } from "https://denopkg.com/chiefbiiko/sha256@v1.0.0/mod.ts";

const nc = await connect({ servers: "localhost:4222" });
const js = nc.jetstream();
console.log("connected");

const sub = nc.subscribe("tests.object-store.>");

const defaultBucket = async function (m: Msg): Promise<void> {
const config = m.json<{
config: {
bucket: string;
};
}>();
await js.views.os(config.config.bucket);
m.respond();
};

const customBucket = async function (m: Msg): Promise<void> {
const testRequest = m.json<{ config: Record<string, unknown> }>();
console.log(`custom config: ${JSON.stringify(testRequest)}`);
const name = testRequest.config.bucket as string || "";
delete testRequest.config.bucket;
testRequest.config.millis = millis(testRequest.config.max_age as number || 0);
await js.views.os(name, testRequest.config);
m.respond();
};

const putObject = async function (m: Msg): Promise<void> {
const testRequest = m.json<{
bucket: string;
url: string;
config: {
description: string;
name: string;
};
}>();
console.log(`put object config: ${JSON.stringify(testRequest)}`);

const file = await fetch(testRequest.url);

if (!file.body) {
throw new Error("Failed to fetch body");
}
const bucket = await js.views.os(testRequest.bucket);

await bucket.put(testRequest.config, file.body);
m.respond();
};

const getObject = async function (m: Msg): Promise<void> {
const testRequest = m.json<
{
bucket: string;
object: string;
}
>();
console.log(`get object config: ${JSON.stringify(testRequest)}`);

const bucket = await js.views.os(testRequest.bucket);
const object = await bucket.getBlob(testRequest.object);

if (!object) {
throw new Error("Failed to get object");
}

const hash = sha256(object);
m.respond(hash);
};

const updateMetadata = async function (m: Msg): Promise<void> {
const testRequest = m.json<
{
bucket: string;
object: string;
config: {
description: string;
name: string;
};
}
>();
const bucket = await js.views.os(testRequest.bucket);
await bucket.update(testRequest.object, testRequest.config);
m.respond();
};

const watchUpdates = async function (m: Msg): Promise<void> {
const testRequest = m.json<{
bucket: string;
}>();

const bucket = await js.views.os(testRequest.bucket);
const iter = await bucket.watch({ includeHistory: false });

for await (const object of iter) {
m.respond(object?.digest);
break;
}
};

const watch = async function (m: Msg): Promise<void> {
const testRequest = m.json<{
bucket: string;
}>();

const bucket = await js.views.os(testRequest.bucket);
const iter = await bucket.watch({ includeHistory: true });

const values: string[] = [];
for await (const object of iter) {
if (object) {
values.push(object.digest);
}
if (values.length == 2) {
break; // Exit the loop once two values have been collected
}
}
const result = values.join(",");
m.respond(result);
};

const getLink = async function (m: Msg): Promise<void> {
const testRequest = m.json<{
object: string;
bucket: string;
}>();

const bucket = await js.views.os(testRequest.bucket);
const object = await bucket.getBlob(testRequest.object);

if (object) {
const hash = sha256(object);
m.respond(hash);
}
};

const putLink = async function (m: Msg): Promise<void> {
const testRequest = m.json<{
object: string;
bucket: string;
link_name: string;
}>();

const bucket = await js.views.os(testRequest.bucket);
const object = await bucket.get(testRequest.object);

if (object) {
await bucket.link(testRequest.link_name, object.info);
}
m.respond();
};

const result = function (test: string) {
return function (message: Msg): Promise<void> {
if (message.headers) {
console.log(`test ${test} failed`);
return Promise.reject("test failed");
} else {
console.log(`test ${test} ok`);
return Promise.resolve();
}
};
};

const opts = [
defaultBucket,
result("defaultBucket"),
customBucket,
result("customBucket"),
putObject,
result("putObject"),
getObject,
result("getObject"),
updateMetadata,
result("updateMetadata"),
watchUpdates,
result("watchUpdates"),
watch,
result("watch"),
getLink,
result("getLink"),
putLink,
result("putLink"),
];

console.log("waiting for tests");
let i = 0;
for await (const m of sub) {
await opts[i++](m);
}
console.log("all tests done");