Commit Graph

193 Commits

Author SHA1 Message Date
Brad Fitzpatrick d030e15d5a app/publisher, make.go: remove publisher/GopherJS support
The publisher app required GopherJS which has been behind upstream Go
for many years. This just removes all GopherJS stuff, breaking the publisher
app in the process. We'll have to rewrite it.

Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2023-12-31 13:17:08 -08:00
Brad Fitzpatrick 98dff16008 clients/web/embed/closure: use modern go:embed instead of old bespoke make.go hack
Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2023-12-31 12:15:42 -08:00
Oleksandr Redko 44b1dbe0f6 all: refactor to net/http statuses instead of ints 2023-01-24 08:39:29 -08:00
Oleksandr Redko 001c417e73
all: replace deprecated io/ioutil with io and os (#1647) 2023-01-23 10:25:14 -08:00
Michael Hoffmann f06efdb51f misc: remove sha1 from tests, remove testhooks, minor cleanups 2023-01-13 07:58:19 -08:00
Brad Fitzpatrick 921894783b all: gofmt for Go 1.19
Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2022-12-31 22:45:40 -08:00
Michael Hoffmann 5c74899d34 tests: clean up upload test 2022-12-30 08:32:54 -08:00
Eng Zer Jun 2977046a4c all: use `T.TempDir` to create temporary directory
The directory created by `T.TempDir()` and is automatically removed when
the test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-03-04 08:18:24 -08:00
Michael Hoffmann 5b6e59539d cleanup: remove pkg/test/asserts
This PR removes the deprecated pk/test/asserts.
2022-03-04 08:17:07 -08:00
Tamás Gulácsi 1c400bd5b3 Remove unused code
as `staticcheck -checks=U1000` suggested.
2021-08-09 17:34:14 +02:00
Alexandre Viau fb961cf310
make codebase go-vet-clean (#1379)
Co-authored-by: Bob Glickstein <bobg@emphatic.com>
2021-07-26 21:19:53 -04:00
aviau 317e9f5490 fs: don't cause io errors on missing blobrefs
- Looking up missing blobrefs would cause fs errors. Instead, simply
  return fuse.ENOENT.

- Add tests for:
   * validating that the mountpoint/<blobref> lookups work

   * validating that the mountpount/<blobref> lookups don't fail when
     the blob does not exist.
2021-02-01 00:00:22 -05:00
aviau c5a95677e7 buildsystem: deprecate perkeepd goui
- GopherJS is no longer required to build the perkeepd ui.

- Rename the `-buildWebUI` flag to `-buildPublisherUI`. Only the
  publisher needs gopherjs.

- Adapt `make.go` so that it no longer tries to generate the perkeepd
  web interface with GopherJS.

- Adapt `make.go` so that it no longer tries to download goui.js from
  perkeep.org as it isn't needed anymore.
2021-01-23 19:45:14 -05:00
Will Norris 8d01945f09 tests: further exclude windows from symlink tests
os.Symlink returns a nil error in some cases (when permissions allow), but
still does not behave as expected.  Skip Windows altogether from some of these
tests for the time being.
2020-09-24 16:31:40 -07:00
Will Norris a53d9d364e test: use filepath.Join for filenames 2020-09-24 16:31:40 -07:00
mpl 249ea1f220 test/dockertest: allow the <repository:tag> syntax for images 2019-06-06 15:03:15 -07:00
mpl 0ce51e6618 pkg/test: fix usage of make.go
Because --skip_gopherjs does not exist anymore

Change-Id: I537f9bc2efacd00fc09a7d3e3d72be85154e8684
2019-04-30 13:58:26 +02:00
mpl e007f66b76 vendor: update github.com/go-sql-driver/mysql
To rev 99ff426eb706cffe92ff3d058e168b278cabf7c7

To support the new default authentication plugin in MySQL 8.

Interestingly, the update also revealed an error unseen so far.
Each of the pkg/sorted/mysql test uses a docker container. If we did not
kill the container at the end of a test, docker would use a new,
different, IP address for each mysql container (which would dodge the
error I'm about to mention). But since we do clean up and remove the
container for each test, then each test gets a container with the same
(first in the range) IP address, because docker "thinks" everything
about the previous container was properly removed.
However, it turns out that since we had forgotten to tell the client
code to close the connection to the mysql server, then the server-side
IP:port is still seen as occupied (even though the server is gone). And
since the second (or nth) test client tries connecting to the same
IP:port, the connection fails.

TL;DR: we also need to close the connection to the DB on the client
side, even though the server in container goes away after each test.

Fixes #1114

Change-Id: I76ce4ac2ee7703f92a9431116cd82ab75da541f7
2018-08-07 21:20:11 +02:00
Euan Kemp 90042fe296 pkg/blobserver/s3: use official aws client
vendor: add github.com/aws/aws-sdk-go at rev bc3f534c19ffdf835e524e11f0f825b3eaf541c3

This changes all uses of the s3 client to be the official aws-sdk-go. As
such, it also deletes the previous client maintained in internal.

There are a few notable changes that come with this:

1. An 'aws_region' key is added to the low-level config. The
   'get-bucket-location' call is used to identify the correct region
   rather than using the redirect returned to determine it.
2. Deleting multiple objects at once is much faster (batches of up to
   1000 vs 1 at a time).
3. Retriable errors are retried automatically (see #1184).
4. Newer APIs are used for some operations (v2 / batch apis).

An unfortunate result of 4 is that this is technically a backwards
incompatible change. An IAM policy which used to be sufficient for
perkeep may no longer permit some of the new api calls (even if they're
not doing anything different really).

Fixes #1184, #911

Change-Id: I077fe88def18b7e9a14267820773245e7003634c
2018-07-31 15:51:31 -07:00
mpl a538874c07 pkg/client: move upload test to pkg/test/integration
In 877eafa49b , pkg/server started
importing pkg/client , since the server has to be able to fetch blobs
from a share claim of another server. This introduced a circular
dependency in tests, as pkg/client/upload_test.go instantiates a server.

As the test uses both a client and a server, and tests uploading between
the two, it seems fitting to move it to pkg/test/integration, which
breaks the circular dep.

Change-Id: I2458ffd72912ff6e9c1a0f67e187d54cc895c2e9
2018-06-27 21:08:46 +02:00
mpl 079024338d pkg/test: append .exe to bin name on Windows
Change-Id: I3de5f33768dffafd79cbe973e3e0435b0614bd9e
2018-05-17 21:10:21 +02:00
mpl 0ce4a8b2a4 pkg/test: give the World a GOBIN
I have tested that, starting with an empty $GOPATH/bin, after running
devcam test, $GOPATH/bin still has none of the Perkeep related binaries.

Fixes #1139

Change-Id: I60b63ff917cf91c8d424b448f874f40a18e1c23b
2018-05-16 01:34:22 +02:00
Brad Fitzpatrick 12894d4630 all: Windows fixes (don't listen on file descriptors in test.World, etc)
test/integration: don't listen on file descriptors.
make.go: unrelated, but options to make it much faster.
internal/images: t.Skip on HEIC dependency failures

Fixes #1140
Updates golang/go#25210

Change-Id: I8092155411826d6ed1f8d85230b753d1369044af
2018-05-01 21:38:19 -07:00
Brad Fitzpatrick 31857ec50b test/integration: skip more symlink tests on Windows
Change-Id: I555a4db1e048e65517471090d4a10ad16f5f0167
2018-05-01 14:40:30 -07:00
Brad Fitzpatrick 3b1828d79f pkg/test: remove check that GOPATH is set
We can also use the implicit one, so don't require an explicit one.

Change-Id: Ie4712be849f40b8f8cc30f99d019dd863944289f
2018-05-01 14:13:41 -07:00
Brad Fitzpatrick c25b330d8d test/integration: fix tests after earlier change to root handler
In f8bc4ac6e5 I made the root handler start returning 404s for
unknown URLs, which broke this test. Update this tests.

Fixes #1132

Change-Id: I6e14811dda00e741d80e1c5603f849ffcb26f361
2018-04-29 10:15:21 -07:00
mpl 7247d11107 pkg/test/docker: force the MySQL version to 5
Since we don't support the latest MySQL version, our tests in Travis CI
are failing since they pull the latest docker image.

We should fix the issue
(https://github.com/perkeep/perkeep/issues/1114), but in the meantime,
we might as well restrict the tests to MySQL 5, so that CI tests keep on
being useful to alert us about other errors.

Change-Id: I32a2cc1dc5a4194c891183d96498dee14c759baf
2018-04-24 19:45:27 -07:00
mpl 7a27eb42eb cmd: rename camget to pk-get, and make it a mode of pk
A couple of related fixes and renames too.

Updates #981
Fixes #1056

Change-Id: Id47a933c77422edfb9db41d34c38ed9d0d7a1846
2018-04-22 20:50:54 -07:00
mpl e778290117 pkg/test: do not expect binaries in ./bin
As make.go now does not install binaries in ./bin, but rather let them be
installed wherever go install does, the test World should now rely on
os/exec's LookPath to find the binaries it needs.

Fixes related failing tests

Change-Id: I256e79673ca994001e831aed9e7a3ab5ba485ead
2018-04-22 11:59:12 -07:00
Brad Fitzpatrick ca76a40bbc Rename camlistored to perkeepd.
Updates #981

Change-Id: I8fe43c240c149074c23128a89ab426af9cbf94b4
2018-04-21 11:06:09 -07:00
mpl ce4658abfc cmd: rename camput to pk-put, and make "pk put" call it
A new "put" mode is added to the pk command, so that the "pk put"
command can be used to create and upload blobs.

What this command does is actually just call the previously named
"camput" executable, which is renamed to "pk-put" in this change.

This involves adding a new way to register a mode in cmdmain, when such
a mode is just meant to call an external binary. To emphasize the
distinction, the existing func (to register a sub-command, or a mode) is
renamed from RegisterCommand to RegisterMode, and RegisterCommand is now
the name of the new func/way.

Updates #981
Updates #1056

Change-Id: Ief954c17aa88a376f551df7de4b4e9fe41ad96d1
2018-04-21 10:26:55 -07:00
mpl f8ef262ff9 make.go: clean up, notably remove the tmp source code mirroring
Fixes #1004

Change-Id: Iea01cfc601b8dd8f2a81fe5da40cdd272b164bb1
2018-04-17 19:39:46 +02:00
mpl 6dcbe2ee9c cmd/camtool: rename from camtool to pk
Updates #981
Updates #1056

Change-Id: Ib78c47a69fa9816d5ac6cc547586a2af321005e3
2018-03-06 16:20:59 +01:00
mpl 5df7a8c8d3 all: fix search owner use for integration tests
Follow-up of b89bf256d1

Change-Id: I26b9f71b7131b591e185781b61a80221c503ab6e
2018-02-09 02:22:01 +01:00
Paul Lindner 84b2c6b3e4 all: various lint fixes
- correct logging that logged functions instead of their value
- use ID vs Id naming
- use correct function names in comments

Change-Id: I61562cef7ebac7337ec6c85312cdf7915cb1a84b
2018-02-05 11:59:00 -08:00
Brad Fitzpatrick f9f109ffa1 all: more Camlistore to Perkeep renamings
Updates #981

Change-Id: I7fd4958bceaa4ada63d07aacf08af11cc03f32d7
2018-01-30 13:31:59 -08:00
Paul Lindner 459c75410e all: more renaming of Camlistore to Perkeep
Change-Id: I118e3cbcf20d80afeffc84f001388c4556f21628
2018-01-30 03:02:56 -08:00
Brad Fitzpatrick 66db09453f blobserver: add context to BlobRemover
Updates #733

Change-Id: I2fffb5cad59aa994441ee82ac5d940270113ee5a
2018-01-19 09:54:46 -08:00
Brad Fitzpatrick 194d4f9443 blobserver, all: add contexts to ReceiveBlob, Fetch & million resulting deps
I had intended for this to be a small change.

I was going to just add context.Context to the BlobReceiver interface,
but then I saw blob.Fetcher could also use one, so I decided to do two
in one CL.

And then it got a bit infectious and ended up touching everything.

I ended up doing SubFetch in the process by necessity.

At a certain point I finally started using context.TODO() in a few
spots, but not too many. But removing context.TODO() will come in the
future. There are more blob storage interfaces lacking context, too,
like RemoveBlobs.

Updates #733

Change-Id: Idf273180b3f8e397ac5929c6d7f520ccc5cdce08
2018-01-18 16:22:16 -08:00
Paul Lindner 990b613e2e pkg/test/integration: fix websocket integration test failures
In rev: 837fe8ac46 a new
version of websocket was imported and changes were made to use
origin checking.  This integration test was missed during those
changes.

This change fixes this test and adds the origin data to the
request, uses the correct 'ws' scheme and uses the new Dialer
API to make requests.

Change-Id: I93e8228794665012f15370532cdeda3cb702ea00
2018-01-12 06:24:38 -08:00
Brad Fitzpatrick 38f10a7bd0 all, testhooks: use sha224 by default, add hook for some tests to use sha-1
Remove the blob.SHA{1,224}From{Bytes,String} constructors too. No
longer used. This adds blob.RefFromBytes which was missing. We had
blob.RefFromString. Now everything uses blob.RefFrom* instead of
specifying a hash function.

Some tests set a flag to force use of SHA-1 because there was too much
golden data to update. We can remove those one-by-one over time as we
fix up tests.

Updates #537

Change-Id: Ibe6428089a6221594c2b751f53f98b03b5a28dc2
2018-01-09 20:03:38 -08:00
Brad Fitzpatrick 617ac40512 all: rename cammount to pk-mount
Updates #981

Change-Id: Ie1d2e3c0fd7e2b7a7801ceac0fd8f93f62d56651
2018-01-08 09:54:41 -08:00
Brad Fitzpatrick 01419ae02d pkg/test/integration: skip non-UTF-8 test on filesystems requiring UTF-8
Fixes #1025

Change-Id: Ia6212140197958ef6660bf3ced6a9bb427ae5aef
2018-01-08 06:47:16 -08:00
Brad Fitzpatrick 57648c6b83 all: update copyright holder from Google Inc to The Perkeep Authors
The AUTHORS file is the list of copyright holders.
2018-01-03 16:52:49 -08:00
Brad Fitzpatrick c3d05cdce9 Move more packages out of pkg/ and into internal/
Moved hashutil, httputil, osutil, netutil,
images, media, magic, video, and rollsum.
2018-01-02 21:03:30 -08:00
Brad Fitzpatrick d6a0b05df0 Rename import paths from camlistore.org to perkeep.org.
Part of the project renaming, issue #981.

After this, users will need to mv their $GOPATH/src/camlistore.org to
$GOPATH/src/perkeep.org. Sorry.

This doesn't yet rename the tools like camlistored, camput, camget,
camtool, etc.

Also, this only moves the lru package to internal. More will move to
internal later.

Also, this doesn't yet remove the "/pkg/" directory. That'll likely
happen later.

This updates some docs, but not all.

devcam test now passes again, even with Go 1.10 (which requires vet
checks are clean too). So a bunch of vet tests are fixed in this CL
too, and a bunch of other broken tests are now fixed (introduced from
the past week of merging the CL backlog).

Change-Id: If580db1691b5b99f8ed6195070789b1f44877dd4
2018-01-01 16:03:34 -08:00
Steven L. Speek 13c084739c search: expression/constraint aliases
The search handler can store and retrieve search aliases.
Keyword namedSearch handles these new atoms of the form
named:foo.

Creating an alias has been implemented using a client in
the camtool subcommands named-search-get and named-search-set.

Change-Id: I7960f83bad464eb1a971c07f33631744a5eea814
2017-12-29 21:41:20 -08:00
Stephen Searles 6b426cb10d improve proxycache and stats blobservers
improving proxycache
- added fuller sample config to the package documentation
- switched the stats caching from sorted.kv to the stats blobserver
- added a cleaning mechanism to evict the least recently used blobs
- implemented StatBlobs to actually inspect the local cache. It still
  always consults the origin, but only for the blobs necessary after
  giving the cache a 50ms headstart.
- logging a few errors that were previously ignored
- added tests modeled after the tests for the localdisk blobstore
- added a method to verify the cache, and call it on initialization
- added a strictStats option to always get stats from the origin
- filling in cacheBytes on initialization

improving stats blobserver
- implemented a few more of the blobserver interfaces, Enumerator and
  Remover
- Fixed a bug(?) in ReceiveBlob that seemed to prevent it from actually
  storing stats
- added a test

minor improvements include:
- blobserver/memory: allowing the memory blobserver to hold actually
  infinite items, if desired
- blobserver: closing dest in the NoImpl blobserver, as required by the
  BlobEnumerator interface
- storagetest: not closing dest leads to deadlock
- lru: max entries of 0 now means infinite (maybe do anything <0?)
- test: a helper function to create a random blob using a global random
  source that is, by default, deterministic, to make test results more
  consistent.

In the future, an improved BlobHub or similar interface could allow a
tighter feedback loop in providing cache consistency. i.e. the cache
could register with backend stores to be notified of content updates,
minimizing the time between backend changes and cache correction.

The proxycache will verify itself at startup, reporting an error if
any of its blobs do not exist in the backend storage or if the backend
storage has a different size for the content than the cache.

Fixes #443

Change-Id: I9ee1efd8c1d0eed49bb82930c2489a64122d3e00
2017-12-29 10:09:15 -08:00
Paul Lindner 15feaeb24c all: lint fixes for 'error strings should not be capitalized or end with punctuation or a newline'
Change-Id: I9c3766a51ac8be694ae76befff4b6fa9a85e34eb
2017-12-11 06:13:25 -08:00
mpl a91a98c58a pkg/test: remove FakeIndex
And fix its main users: tests in pkg/search.

Fixes #883

Change-Id: Ib04b8d6f2d56bfb24a8900520c97b24bccb3c78b
2017-12-01 19:59:26 +01:00