RousselTMLEARNING

TP · Google Cloud: from discovery to expertise

Lab: Cloud Storage locally with fake-gcs-server

What you will learn in this TP
  • Run fake-gcs-server
  • Use the Cloud Storage library
  • Test without the cloud

Introduction #

What you will learn in this section
  • Run fake-gcs-server
  • Use the Cloud Storage library
  • Test without the cloud

Context. The report export code must be tested in CI without Google Cloud access. You run it against an emulator.

Prerequisites: Docker, Python 3 and the Google Cloud SDK (gcloud with emulator components); no Google Cloud project or billing needed  ·  Estimated time: 35 min

Export code automatically tested against emulated Cloud Storage.

Hands-on #

Guided steps, with their solution.

  1. 1. Start the emulator

    Why? STORAGE_EMULATOR_HOST redirects the Python library to the emulator.

    Run fake-gcs-server and install the library.
  2. 2. Write the export code

    Why? Organising by date with prefixes eases lifecycle and search.

    Create export.py that creates the bucket if needed and uploads a CSV under YYYY/MM/ with metadata.
  3. 3. Test automatically

    Why? The same test runs in CI with a fake-gcs-server service.

    Write a pytest test that exports then reads the object back, and run it.

Difficulty level : ●●○○○ (2/5)

My progress

  • ⏱ Estimated time : ≈ 35 min

Sign in to track your progress and take notes. Sign in

💬 Ask a question

Recommended Articles

Le stockage Google Cloud : Cloud Storage, disques persistants et Filestore

Stocker des données sur Google Cloud : Cloud Storage (classes, emplacements régionaux, birégionau...

Le calcul sur Google Cloud : Compute Engine, GKE, Cloud Run et Cloud Functions

Choisir le calcul sur Google Cloud : VM Compute Engine et groupes d'instances gérés, Google Kuber...

Les bases de données Google Cloud : Cloud SQL, AlloyDB, Spanner, Firestore et Bigtable

Choisir une base de données sur Google Cloud : Cloud SQL et AlloyDB pour le relationnel, Spanner ...

Comprendre Google Cloud : régions, projets, hiérarchie, outils et tarification

Les bases de Google Cloud : régions et zones, hiérarchie organisation, dossiers et projets, API à...

IAM sur Google Cloud : rôles, comptes de service et règles d'administration

Gérer les accès sur Google Cloud : principaux, rôles de base, prédéfinis et personnalisés, liaiso...

Préparer la certification Google Cloud Digital Leader

Guide de préparation au Cloud Digital Leader : format, domaines (transformation numérique, donnée...

Préparer la certification Google Associate Cloud Engineer

Guide de préparation à l'Associate Cloud Engineer : format, cinq domaines (mise en place, planifi...

Bonnes pratiques Google Cloud : organisation, sécurité, fiabilité et coûts

Les bonnes pratiques pour exploiter Google Cloud : organisation et dossiers, projets par environn...

Le réseau Google Cloud : VPC mondial, sous-réseaux, pare-feu et équilibrage

Concevoir le réseau sur Google Cloud : VPC mondial et sous-réseaux régionaux, règles de pare-feu ...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!