hubcio commented on code in PR #2983: URL: https://github.com/apache/iggy/pull/2983#discussion_r2969412667
########## web/src/routes/healthz/route.test.mjs: ########## @@ -0,0 +1,35 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 assert from 'node:assert/strict'; +import test from 'node:test'; +import { GET, prerender } from './+server.ts'; Review Comment: this `.mjs` file imports `.ts` directly. `node --test` will fail on this without `--experimental-strip-types` (node 22.6-23.5) or node >= 23.6 where type stripping is unflagged. the `package.json` test script is just `"test": "node --test"` with no flags. either add `--experimental-strip-types` to the test script, rename the test to `.ts` and use a ts-aware runner, or import from compiled output. ########## web/src/routes/healthz/+server.ts: ########## @@ -0,0 +1,30 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + +const STATUS_OK = 'ok'; + +export const prerender = true; + +export const GET = () => + new Response(STATUS_OK, { + headers: { + 'cache-control': 'no-store', Review Comment: `cache-control: no-store` with `prerender = true` is contradictory. since this is prerendered, sveltekit generates a static file at build time. the `Response` headers are only used during prerendering - once served as a static file (nginx, adapter-node, etc.), the actual http cache-control header will be whatever the static file server sets, not what's in the handler. this header is effectively dead code in a prerendered context. either drop the `cache-control` header (since it has no effect), or document that the serving layer must set `cache-control: no-store` for `/healthz` if caching is a concern. ########## web/src/routes/healthz/route.test.mjs: ########## @@ -0,0 +1,35 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 assert from 'node:assert/strict'; +import test from 'node:test'; +import { GET, prerender } from './+server.ts'; Review Comment: test file lives inside `src/routes/`. sveltekit only treats `+`-prefixed files as route files so this won't be served as a page, but co-locating test files in the routes directory is unconventional. if the project already has a convention for test file placement (e.g. `tests/` or `__tests__/`), consider following it. ########## helm/charts/iggy/templates/deployment.yaml: ########## @@ -181,11 +181,11 @@ spec: protocol: TCP livenessProbe: httpGet: - path: / + path: /healthz Review Comment: no `startupProbe` for the UI deployment. PR #2976 added one for the server with `failureThreshold: 30` / `periodSeconds: 10` to give 5 min startup budget. the UI likely starts faster so this is minor, but for consistency you might want one here too. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
