Merge pull request #13060 from overleaf/bg-upgrade-fake-gcs-server

upgrade to fake-gcs-server 1.45.2

GitOrigin-RevId: 6ae47211370eedabbf9416498e150f53f1bc8fe4
This commit is contained in:
Brian Gough 2023-07-21 12:04:10 +01:00 committed by Copybot
parent c7006fabd4
commit 8623b4d0f4
10 changed files with 64 additions and 18 deletions

View file

@ -57,7 +57,7 @@ services:
interval: 1s
retries: 20
gcs:
image: fsouza/fake-gcs-server:v1.21.2
image: fsouza/fake-gcs-server:1.45.2
command: ["--port=9090", "--scheme=http"]
healthcheck:
test: wget --quiet --output-document=/dev/null http://localhost:9090/storage/v1/b

View file

@ -60,7 +60,7 @@ services:
retries: 20
gcs:
image: fsouza/fake-gcs-server:v1.21.2
image: fsouza/fake-gcs-server:1.45.2
command: ["--port=9090", "--scheme=http"]
healthcheck:
test: wget --quiet --output-document=/dev/null http://localhost:9090/storage/v1/b

View file

@ -39,6 +39,15 @@ describe('Archiving', function () {
await storage.createBucket(`${Settings.docstore.bucket}-deleted`)
})
after(async function () {
// Tear down the buckets created above
const storage = new Storage(Settings.docstore.gcs.endpoint)
await storage.bucket(Settings.docstore.bucket).deleteFiles()
await storage.bucket(Settings.docstore.bucket).delete()
await storage.bucket(`${Settings.docstore.bucket}-deleted`).deleteFiles()
await storage.bucket(`${Settings.docstore.bucket}-deleted`).delete()
})
describe('multiple docs in a project', function () {
before(function (done) {
this.project_id = ObjectId()

View file

@ -3,10 +3,27 @@ const { expect } = require('chai')
const DocstoreApp = require('./helpers/DocstoreApp')
const Errors = require('../../../app/js/Errors')
const Settings = require('@overleaf/settings')
const { Storage } = require('@google-cloud/storage')
const DocstoreClient = require('./helpers/DocstoreClient')
function deleteTestSuite(deleteDoc) {
before(async function () {
// Create buckets needed by the archiving part of these tests
const storage = new Storage(Settings.docstore.gcs.endpoint)
await storage.createBucket(Settings.docstore.bucket)
await storage.createBucket(`${Settings.docstore.bucket}-deleted`)
})
after(async function () {
// Tear down the buckets created above
const storage = new Storage(Settings.docstore.gcs.endpoint)
await storage.bucket(Settings.docstore.bucket).deleteFiles()
await storage.bucket(Settings.docstore.bucket).delete()
await storage.bucket(`${Settings.docstore.bucket}-deleted`).deleteFiles()
await storage.bucket(`${Settings.docstore.bucket}-deleted`).delete()
})
beforeEach(function (done) {
this.project_id = ObjectId()
this.doc_id = ObjectId()

View file

@ -15,6 +15,15 @@ describe('Getting A Doc from Archive', function () {
await storage.createBucket(`${Settings.docstore.bucket}-deleted`)
})
after(async function () {
// Tear down the buckets created above
const storage = new Storage(Settings.docstore.gcs.endpoint)
await storage.bucket(Settings.docstore.bucket).deleteFiles()
await storage.bucket(Settings.docstore.bucket).delete()
await storage.bucket(`${Settings.docstore.bucket}-deleted`).deleteFiles()
await storage.bucket(`${Settings.docstore.bucket}-deleted`).delete()
})
describe('for an archived doc', function () {
before(function (done) {
this.project_id = ObjectId()

View file

@ -67,7 +67,7 @@ services:
interval: 1s
retries: 20
gcs:
image: fsouza/fake-gcs-server:v1.21.2
image: fsouza/fake-gcs-server:1.45.2
command: ["--port=9090", "--scheme=http"]
healthcheck:
test: wget --quiet --output-document=/dev/null http://localhost:9090/storage/v1/b

View file

@ -75,7 +75,7 @@ services:
interval: 1s
retries: 20
gcs:
image: fsouza/fake-gcs-server:v1.21.2
image: fsouza/fake-gcs-server:1.45.2
command: ["--port=9090", "--scheme=http"]
healthcheck:
test: wget --quiet --output-document=/dev/null http://localhost:9090/storage/v1/b

View file

@ -86,6 +86,15 @@ describe('Filestore', function () {
projectId,
otherProjectId
const BUCKET_NAMES = [
process.env.GCS_USER_FILES_BUCKET_NAME,
process.env.GCS_PUBLIC_FILES_BUCKET_NAME,
process.env.GCS_TEMPLATE_FILES_BUCKET_NAME,
`${process.env.GCS_USER_FILES_BUCKET_NAME}-deleted`,
`${process.env.GCS_PUBLIC_FILES_BUCKET_NAME}-deleted`,
`${process.env.GCS_TEMPLATE_FILES_BUCKET_NAME}-deleted`,
]
before(async function () {
// create the app with the relevant filestore settings
Settings.filestore = BackendSettings[backend]
@ -95,19 +104,21 @@ describe('Filestore', function () {
if (BackendSettings[backend].gcs) {
before(async function () {
// create test buckets for gcs
const storage = new Storage(Settings.filestore.gcs.endpoint)
await storage.createBucket(process.env.GCS_USER_FILES_BUCKET_NAME)
await storage.createBucket(process.env.GCS_PUBLIC_FILES_BUCKET_NAME)
await storage.createBucket(process.env.GCS_TEMPLATE_FILES_BUCKET_NAME)
await storage.createBucket(
`${process.env.GCS_USER_FILES_BUCKET_NAME}-deleted`
)
await storage.createBucket(
`${process.env.GCS_PUBLIC_FILES_BUCKET_NAME}-deleted`
)
await storage.createBucket(
`${process.env.GCS_TEMPLATE_FILES_BUCKET_NAME}-deleted`
)
for (const bucketName of BUCKET_NAMES) {
await storage.createBucket(bucketName)
}
})
after(async function () {
// tear down all the gcs buckets
const storage = new Storage(Settings.filestore.gcs.endpoint)
for (const bucketName of BUCKET_NAMES) {
const bucket = storage.bucket(bucketName)
await bucket.deleteFiles()
await bucket.delete()
}
})
}

View file

@ -66,7 +66,7 @@ services:
retries: 20
gcs:
image: fsouza/fake-gcs-server:v1.21.2
image: fsouza/fake-gcs-server:1.45.2
command: ["--port=9090", "--scheme=http"]
healthcheck:
test: wget --quiet --output-document=/dev/null http://localhost:9090/storage/v1/b

View file

@ -69,7 +69,7 @@ services:
retries: 20
gcs:
image: fsouza/fake-gcs-server:v1.21.2
image: fsouza/fake-gcs-server:1.45.2
command: ["--port=9090", "--scheme=http"]
healthcheck:
test: wget --quiet --output-document=/dev/null http://localhost:9090/storage/v1/b