[GH-ISSUE #1033] Unable to add files directly to the filesystem #160

Open
opened 2026-03-03 12:08:49 +03:00 by kerem · 3 comments
Owner

Originally created by @drehelis on GitHub (Jan 6, 2023).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/1033

Running fake-gcs with the following args:

docker run --rm --name fake-gcs-server -p 4443:4443 -v ${PWD}/examples1/data:/data fsouza/fake-gcs-server -scheme http -data /data -filesystem-root /data

curl "localhost:4443/storage/v1/b"
{"kind":"storage#buckets","items":[]}

mkdir examples1/data/{1..9}

curl "localhost:4443/storage/v1/b" | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   820  100   820    0     0  54503      0 --:--:-- --:--:-- --:--:-- 91111
{
  "kind": "storage#buckets",
  "items": [
    {
      "kind": "storage#bucket",
      "id": "1",
      "name": "1",
      "versioning": {},
      "location": "US-CENTRAL1"
    },
    {
      "kind": "storage#bucket",
      "id": "2",
      "name": "2",
      "versioning": {},
      "location": "US-CENTRAL1"
    },
   ...
   ...
   ... 
  ]
}

curl "localhost:4443/storage/v1/b/1/o"
{"kind":"storage#objects","items":[]}

touch examples1/data/1/dummy.txt
curl "localhost:4443/storage/v1/b/1/o"
{"error":{"code":404,"message":"Not Found","errors":null}}

restarting fake-gcs.

curl "localhost:4443/storage/v1/b/1/o"
{"kind":"storage#objects","items":[{"kind":"storage#object","name":"dummy.txt","id":"1/dummy.txt","bucket":"1","size":"0","contentType":"text/plain; charset=utf-8","crc32c":"AAAAAA==","md5Hash":"1B2M2Y8AsgTpgAmY7PhCfg==","etag":"\"1B2M2Y8AsgTpgAmY7PhCfg==\"","timeCreated":"2023-01-06T21:33:21.935431Z","updated":"2023-01-06T21:33:21.935455Z","generation":"1673040801935643"}]}


Originally created by @drehelis on GitHub (Jan 6, 2023). Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/1033 Running `fake-gcs` with the following args: ``` docker run --rm --name fake-gcs-server -p 4443:4443 -v ${PWD}/examples1/data:/data fsouza/fake-gcs-server -scheme http -data /data -filesystem-root /data curl "localhost:4443/storage/v1/b" {"kind":"storage#buckets","items":[]} mkdir examples1/data/{1..9} curl "localhost:4443/storage/v1/b" | jq % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 820 100 820 0 0 54503 0 --:--:-- --:--:-- --:--:-- 91111 { "kind": "storage#buckets", "items": [ { "kind": "storage#bucket", "id": "1", "name": "1", "versioning": {}, "location": "US-CENTRAL1" }, { "kind": "storage#bucket", "id": "2", "name": "2", "versioning": {}, "location": "US-CENTRAL1" }, ... ... ... ] } curl "localhost:4443/storage/v1/b/1/o" {"kind":"storage#objects","items":[]} touch examples1/data/1/dummy.txt curl "localhost:4443/storage/v1/b/1/o" {"error":{"code":404,"message":"Not Found","errors":null}} restarting fake-gcs. curl "localhost:4443/storage/v1/b/1/o" {"kind":"storage#objects","items":[{"kind":"storage#object","name":"dummy.txt","id":"1/dummy.txt","bucket":"1","size":"0","contentType":"text/plain; charset=utf-8","crc32c":"AAAAAA==","md5Hash":"1B2M2Y8AsgTpgAmY7PhCfg==","etag":"\"1B2M2Y8AsgTpgAmY7PhCfg==\"","timeCreated":"2023-01-06T21:33:21.935431Z","updated":"2023-01-06T21:33:21.935455Z","generation":"1673040801935643"}]} ```
Author
Owner

@fsouza commented on GitHub (Jan 6, 2023):

Yeah, that's not supported and can't really be supported. The format in the filesystem root is not regular folders and files, and it'll change further once that backend supports generations (#744).

One thing we could do is to add an internal endpoint for "reseeding" fake-gcs-server from a folder, like we do on process start.

<!-- gh-comment-id:1374171857 --> @fsouza commented on GitHub (Jan 6, 2023): Yeah, that's not supported and can't really be supported. The format in the filesystem root is not regular folders and files, and it'll change further once that backend supports generations (#744). One thing we could do is to add an internal endpoint for "reseeding" fake-gcs-server from a folder, like we do on process start.
Author
Owner

@drehelis commented on GitHub (Jan 6, 2023):

Heh, interesting.. as it works for the bucket level :)
Something like http://localhost:4443/reseed for re-reading the filesystem?

<!-- gh-comment-id:1374181550 --> @drehelis commented on GitHub (Jan 6, 2023): Heh, interesting.. as it works for the bucket level :) Something like `http://localhost:4443/reseed` for re-reading the filesystem?
Author
Owner

@fsouza commented on GitHub (Jan 7, 2023):

Yeah, something like /_internal/reseed (we have other /_internal endpoints currently).

<!-- gh-comment-id:1374647025 --> @fsouza commented on GitHub (Jan 7, 2023): Yeah, something like `/_internal/reseed` (we have other `/_internal` endpoints currently).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/fake-gcs-server#160
No description provided.