Commit Graph

194 Commits (master)

Author SHA1 Message Date
Eng Zer Jun 903d30d658
test: use `T.TempDir` to create temporary test directory (#23258)
* test: use `T.TempDir` to create temporary test directory

This commit replaces `os.MkdirTemp` with `t.TempDir` in tests. The
directory created by `t.TempDir` is automatically removed when the test
and all its subtests complete.

Prior to this commit, temporary directory created using `os.MkdirTemp`
needs to be removed manually by calling `os.RemoveAll`, which is omitted
in some tests. The error handling boilerplate e.g.
	defer func() {
		if err := os.RemoveAll(dir); err != nil {
			t.Fatal(err)
		}
	}
is also tedious, but `t.TempDir` handles this for us nicely.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* test: fix failing TestSendWrite on Windows

=== FAIL: replications/internal TestSendWrite (0.29s)
    logger.go:130: 2022-06-23T13:00:54.290Z	DEBUG	Created new durable queue for replication stream	{"id": "0000000000000001", "path": "C:\\Users\\circleci\\AppData\\Local\\Temp\\TestSendWrite1627281409\\001\\replicationq\\0000000000000001"}
    logger.go:130: 2022-06-23T13:00:54.457Z	ERROR	Error in replication stream	{"replication_id": "0000000000000001", "error": "remote timeout", "retries": 1}
    testing.go:1090: TempDir RemoveAll cleanup: remove C:\Users\circleci\AppData\Local\Temp\TestSendWrite1627281409\001\replicationq\0000000000000001\1: The process cannot access the file because it is being used by another process.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* test: fix failing TestStore_BadShard on Windows

=== FAIL: tsdb TestStore_BadShard (0.09s)
    logger.go:130: 2022-06-23T12:18:21.827Z	INFO	Using data dir	{"service": "store", "path": "C:\\Users\\circleci\\AppData\\Local\\Temp\\TestStore_BadShard1363295568\\001"}
    logger.go:130: 2022-06-23T12:18:21.827Z	INFO	Compaction settings	{"service": "store", "max_concurrent_compactions": 2, "throughput_bytes_per_second": 50331648, "throughput_bytes_per_second_burst": 50331648}
    logger.go:130: 2022-06-23T12:18:21.828Z	INFO	Open store (start)	{"service": "store", "op_name": "tsdb_open", "op_event": "start"}
    logger.go:130: 2022-06-23T12:18:21.828Z	INFO	Open store (end)	{"service": "store", "op_name": "tsdb_open", "op_event": "end", "op_elapsed": "77.3µs"}
    testing.go:1090: TempDir RemoveAll cleanup: remove C:\Users\circleci\AppData\Local\Temp\TestStore_BadShard1363295568\002\data\db0\rp0\1\index\0\L0-00000001.tsl: The process cannot access the file because it is being used by another process.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* test: fix failing TestPartition_PrependLogFile_Write_Fail and TestPartition_Compact_Write_Fail on Windows

=== FAIL: tsdb/index/tsi1 TestPartition_PrependLogFile_Write_Fail/write_MANIFEST (0.06s)
    testing.go:1090: TempDir RemoveAll cleanup: remove C:\Users\circleci\AppData\Local\Temp\TestPartition_PrependLogFile_Write_Failwrite_MANIFEST656030081\002\0\L0-00000003.tsl: The process cannot access the file because it is being used by another process.
    --- FAIL: TestPartition_PrependLogFile_Write_Fail/write_MANIFEST (0.06s)

=== FAIL: tsdb/index/tsi1 TestPartition_Compact_Write_Fail/write_MANIFEST (0.08s)
    testing.go:1090: TempDir RemoveAll cleanup: remove C:\Users\circleci\AppData\Local\Temp\TestPartition_Compact_Write_Failwrite_MANIFEST3398667527\002\0\L0-00000003.tsl: The process cannot access the file because it is being used by another process.
    --- FAIL: TestPartition_Compact_Write_Fail/write_MANIFEST (0.08s)

We must close the open file descriptor otherwise the temporary file
cannot be cleaned up on Windows.

Fixes: 619eb1cae6 ("fix: restore in-memory Manifest on write error")
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* test: fix failing TestReplicationStartMissingQueue on Windows

=== FAIL: TestReplicationStartMissingQueue (1.60s)
    logger.go:130: 2023-03-17T10:42:07.269Z	DEBUG	Created new durable queue for replication stream	{"id": "0000000000000001", "path": "C:\\Users\\circleci\\AppData\\Local\\Temp\\TestReplicationStartMissingQueue76668607\\001\\replicationq\\0000000000000001"}
    logger.go:130: 2023-03-17T10:42:07.305Z	INFO	Opened replication stream	{"id": "0000000000000001", "path": "C:\\Users\\circleci\\AppData\\Local\\Temp\\TestReplicationStartMissingQueue76668607\\001\\replicationq\\0000000000000001"}
    testing.go:1206: TempDir RemoveAll cleanup: remove C:\Users\circleci\AppData\Local\Temp\TestReplicationStartMissingQueue76668607\001\replicationq\0000000000000001\1: The process cannot access the file because it is being used by another process.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* test: update TestWAL_DiskSize

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* test: fix failing TestWAL_DiskSize on Windows

=== FAIL: tsdb/engine/tsm1 TestWAL_DiskSize (2.65s)
    testing.go:1206: TempDir RemoveAll cleanup: remove C:\Users\circleci\AppData\Local\Temp\TestWAL_DiskSize2736073801\001\_00006.wal: The process cannot access the file because it is being used by another process.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

---------

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-03-21 16:22:11 -04:00
Jeffrey Smith II f74c69c5e4
chore: update to go 1.20 (#24088)
* build: upgrade to go 1.19

* chore: bump go.mod

* chore: `gofmt` changes for doc comments

https://tip.golang.org/doc/comment

* test: update tests for new sort order

* chore: make generate-sources

* chore: make generate-sources

* chore: go 1.20

* chore: handle rand.Seed deprecation

* chore: handle rand.Seed deprecation in tests

---------

Co-authored-by: DStrand1 <dstrandboge@influxdata.com>
2023-02-09 14:14:35 -05:00
Jamie Strandboge c40ad64604
feat(security): set SameSite=strict on session cookie (#23723)
* feat(security): set SameSite=strict on session cookie

Use SameSite=Strict as a hardening measure against cross-origin attacks.
While browsers have been moving to default to SameSite=Lax, explicitly
setting SameSite ensures that all browsers enforce it consistently.
While 'lax' is a reasonable hardening choice, the cookie is only
required for requests to '/api/...' and we don't expect 3rd party links
into '/api/...', so this stricter setting should be safe in terms of
usability. Furthermore, while our GET APIs are not state-changing, using
'strict' future-proofs us in case we add a state-changing GET API ('lax'
allows cross-origin 'GET' requests for increased usability for read-only
requests).

Also add a comment to SetCORS() lack of Access-Control-Allow-Credentials
as a reminder that its omission is intentional for defense in depth on
when to attach the cookie to a request.

* chore: mention that Lax sends the cookie with other safe HTTP methods
2022-09-15 15:30:19 -05:00
Dane Strandboge 82d1123e78
build: upgrade to Go 1.18.1 (#23252) 2022-04-13 15:24:27 -05:00
Jonathan A. Sternberg adf29dfedf
feat(kit/feature): allow influxdb to set flux feature flags (#23123) 2022-02-24 15:29:17 -06:00
William Baker 5a919b69d7
feat: enable remotes and replication streams feature (#22990) 2021-12-13 16:01:50 -06:00
Daniel Moran 0fbda8397d
feat: recommend `influxd downgrade` after encountering unknown KV migration (#22805) 2021-11-01 11:07:54 -04:00
William Baker 42ac916253
feat: enable new dashboard autorefresh (#22669) 2021-10-13 16:17:03 -06:00
Sam Arnold 5015297d40
fix: more expressive errors (#22448)
* fix: more expressive errors

Closes #22446

* fix: server only logging for untyped errors

* chore: fix formatting
2021-09-13 15:12:35 -04:00
Daniel Moran 3053af7719
test: skip signals test on Windows (#22454)
And use os.Kill instead of syscall.SIGTERM for portability
2021-09-13 12:49:25 -04:00
Daniel Moran 85c38bb77a
feat(replication): add feature flag for replication-stream backend (#22196) 2021-08-13 10:55:43 -04:00
Bucky Schwarz de1bd90f3f
chore: remove annotations and rangeAnnotations flags (#22146) 2021-08-11 11:48:23 -07:00
William Baker 11e5ce0dd3
feat: enable notebooks and annotations (#21972)
* feat: remove notebooks feature flags

* feat: turn on annotations feature flag

* chore: removed unused UI feature flags

* docs: add line to CHANGELOG about notebooks and annotations

* chore: update CHANGELOG
2021-07-29 16:32:12 -06:00
William Baker 4db7978b32
feat(telemetry): Do not record telemetry data for invalid requests; replace invalid static asset paths with a slug (#21958)
* feat: record telemetry data only on successful response codes

* feat: re-write request path in file handler

* fix: use a slug for the replacement path

* chore: update CHANGELOG

* fix: report for 5XX also

* fix: address review comments
2021-07-29 10:22:11 -06:00
William Baker 0cb0da2060
chore: modify/delete some chronograf refs (#21802)
* chore: modify/delete some chronograf refs

* chore: update CHANGELOG
2021-07-08 09:14:03 -05:00
William Baker 04d7742b26
feat: enable the notebooks backend (#21613)
* feat: remove feature flag from notebooks backend
2021-06-04 15:56:34 -04:00
William Baker ed629bfebe
feat(notebooks): notebooks database implementation (#21573) 2021-05-28 09:29:00 -04:00
Jill R. Pelavin 46fe0ee9d1
chore: adding rangeAnnotations feature flag (#21556) 2021-05-25 15:25:05 -04:00
Timmy Luong 3f3670fa1c
feat: remove ui feature flags for permanent features (#21531) 2021-05-21 16:40:35 -07:00
William Baker fee3c46023
fix: add telemetry slug for additional file exts (#21522)
* fix: add telemetry slug for more exts

* chore: update CHANGELOG
2021-05-20 08:58:18 -04:00
Jill R. Pelavin 879feba5f9
chore: remove type ahead flag (#21335) 2021-05-10 12:33:16 -04:00
William Baker 883241eadb
feat: update notebooks api (#21386)
* feat: update notebooks endpoints

* feat: better error messages
2021-05-07 11:00:01 -04:00
William Baker de1d8dc2d6
feat(annotations): add feature flag for annotations (#21220)
* feat(annotations): add feature flag for annotations
2021-04-15 09:53:55 -04:00
Bucky Schwarz a3ddc655b7
chore: remove unused feature flags: communityTemplates, backendExample, frontendExample (#21200) 2021-04-13 14:41:53 -07:00
William Baker 93ea7d534c
feat(ui): enabling feature flags for various UI features (#21172)
* feat(ui): enabling feature flags for various UI features

* fix: re-built flags list

* fix: disabled EOF cursor to avoid breaking so many tests

* fix: re-generated the feature flag output

* fix: disable typeahead variable dropdowns

* fix: fixed explorer e2e test
2021-04-09 11:29:30 -04:00
William Baker 540bb66e13
feat(telemetry): replace unique ids for resources with a slug (#21158)
* feat(telemetry): replace unique ids for resources with a slug

* chore: update CHANGELOG
2021-04-08 09:57:47 -04:00
Daniel Moran 00afd95cb7
refactor: automated move of errors and id from root to kit (#21101)
Co-authored-by: Sam Arnold <sarnold@influxdata.com>
2021-03-30 14:10:02 -04:00
Daniel Moran 316eaa24b4
feat(http): add config option to disable metrics endpoint in influxd (#20963) 2021-03-15 15:11:23 -04:00
Daniel Moran e86ee475b2
fix: make AST-based option parsing the default, remove feature flag (#20875) 2021-03-08 09:51:21 -05:00
Daniel Moran 49b83b58ee
refactor: remove panics from CLI kit code and influxd CLI setup (#20863) 2021-03-04 17:18:21 -05:00
Daniel Moran 1ad8f8d23d
fix(kit/cli): fix loading config from directories with '.' in the name (#20702) 2021-02-05 10:56:12 -05:00
Daniel Moran 4239d037d6
fix(kit/cli): fix loading of .yml config files (#20522) 2021-01-15 17:04:20 -08:00
Daniel Moran 78af2e7317
fix(kit/cli): don't ignore failures to mark CLI options as required (#20490) 2021-01-13 07:25:16 -08:00
Daniel Moran 4235c12d64
refactor(cmd/influxd): parse log-level CLI opts directly to correct type (#20196) 2020-11-30 13:59:06 -05:00
Dan Moran a952dff92d feat(kit/cli): add support for int32 and int64 CLI flags 2020-11-24 13:36:27 -05:00
Arnav Aggarwal 96b26f5a42
Merge pull request #19979 from influxdata/timeFilterTasks
feat(tasks): added functionality to filter runs by time
2020-11-16 13:22:07 -08:00
Stuart Carnie 42aabb28fc chore: Do not use global viper APIs, which breaks testing 2020-11-13 08:47:52 +11:00
Daniel Moran 15b9531273
fix: correct various typos (#19987)
Co-authored-by: kumakichi <xyesan@gmail.com>
2020-11-11 13:54:21 -05:00
Arnav Aggarwal 64a562db42 feat(tasks): added functionality to filter runns by time 2020-11-10 10:30:34 -10:00
Stuart Carnie ae980c3549 feat: Support influxdb.ID as bindable argument in kit/cli 2020-11-09 15:22:05 -05:00
jl 2cc5d86ebd refactor: remove feature flags for pushdowns 2020-10-30 18:09:38 -07:00
Christopher M. Wolff 5a60488729
fix: make tagKeys and tagValues work for edge cases involving _field (#19856) 2020-10-30 10:37:08 -07:00
Mark Rushakoff 10c32e4079 chore: remove unreferenced kit/grpc package 2020-10-28 12:38:01 -04:00
Stuart Carnie 2705c57554 fix(launcher): Switch to AuthorizationService from authorization package
This commit ensures OSS is using the new implementation of the
AuthorizationService from the authorization package.

It also removes the associated feature flag.
2020-10-21 07:44:15 -07:00
Lyon Hill c523fd22f7
chore: clean old feature flags (#19692) 2020-10-06 13:43:32 -06:00
Roger Peppe a10f2ff6fa
Merge pull request #19654 from influxdata/rogpeppe-008-improve-limited-read-closer
chore: kit/io: improve LimitedReadCloser
2020-09-29 07:21:59 +01:00
Roger Peppe 239331c1ae chore: kit/io: improve LimitedReadCloser
A fairly minor change, but this saves two allocations every time
points are written to the API (one allocation for the embedded io.LimitReader,
and one allocation to create the `close` closure).

Also fix the code so that it actually limits to the exact requested number of bytes
rather than one more. We don't really need to layer on top of io.LimitReader,
as that code is fairly minimal.
2020-09-28 18:39:45 +01:00
Bucky Schwarz 838b3ea1b9 feat: turn on community templates 2020-09-24 16:03:06 -07:00
Russ Savage bc4bae3738
fix(middleware): adding PATCH to access control allow methods (#19637)
* fix(middleware): adding PATCH to access control allow methods

* chore(changelog): added PATCH change
2020-09-24 11:49:00 -07:00
Stuart Carnie 9c4dfed391 feat: Add ENotImplemented error code
This is more explicit that EInternal, allowing APIs to indicate
a potentially temporary status of "501 Not implemented"
2020-09-24 11:11:46 -07:00