# Picture share test environment Ticket 4 of the account self-service epic. The picture feature needs two folders and something that plays the part of the sync task. Nothing here touches production: the folders are new, and the stand-in never writes to AD. Time needed: about 15 minutes. ## How the portal uses the share | Folder | Portal access | Content | | --- | --- | --- | | Source folder | writes | `.jpg`, the 512 by 512 picture the portal produced | | Processed folder | reads only | `.md5`, written by the sync task: the MD5 of the source file it processed | The portal shows "Pending" until `processed/.md5` equals the MD5 of the file it wrote. The real task (`AD-ProfilePicture-Sync.ps1`) runs on a domain controller, writes the MD5 file for every user on each run, and sets the AD picture attributes. Its hash is upper case hex with a trailing newline; the portal compares it case-insensitively and trimmed. ## Step A: Create the two folders On the Linux host: ```sh sudo mkdir -p /srv/picture-test/source /srv/picture-test/processed sudo chown -R "$USER": /srv/picture-test ``` Use paths that are clearly test paths. **Never point the test at the production source folder.** When the share becomes an SMB share, the host mounts it (CIFS) and the container still only sees a folder path. Nothing in the portal or in this runbook changes except where the paths point. The mount shape is: ```sh sudo mount -t cifs //fileserver/picture-test /srv/picture-test \ -o credentials=/root/.picture-test.cred,uid=$(id -u),gid=$(id -g),vers=3.0 ``` Keep the credentials file out of this repository. The portal's account needs write on the source folder and read on the processed folder; the stand-in's account needs the opposite. ## Step B: Provide a default image The real task falls back to a default image for users without a picture. Put any JPEG into the processed folder as `default.jpg`: ```sh cp some-picture.jpg /srv/picture-test/processed/default.jpg ``` ## Step C: Run the stand-in `picture-sync-standin.sh` writes the MD5 files the way the real task does and leaves AD alone. Copy it to the host, then: ```sh chmod +x picture-sync-standin.sh export SOURCE=/srv/picture-test/source PROCESSED=/srv/picture-test/processed export USERS="ptest-user1 ptest-user2 ptest-publisher ptest-admin" ./picture-sync-standin.sh # once ./picture-sync-standin.sh 300 # every 5 minutes, until you stop it ``` For the Pending state to be visible in manual tests, run it with a long pause or by hand: the real task runs on a schedule, so a short pause hides the state you want to see. The portal's "taking longer than expected" message appears after a configured time, which you can test by not running the stand-in at all. ## Step D: Prove it works 1. Write a file into the source folder: `cp some-picture.jpg /srv/picture-test/source/ptest-user1.jpg` 2. Run the stand-in once. 3. `cat /srv/picture-test/processed/ptest-user1.md5` shows a 32 character upper case hex string. 4. `md5sum /srv/picture-test/source/ptest-user1.jpg` shows the same value in lower case. 5. Delete `source/ptest-user1.jpg`, run the stand-in again: the MD5 changes to the value of the default image. This is the removal case: the portal treats a changed MD5 as "removal processed". ## Values sheet (write down for the build; no secrets) | Value | Your entry | | --- | --- | | Source folder path on the host | | | Processed folder path on the host | | | Local folder or SMB mount | | | How the MD5 files are produced | stand-in script, run by hand or by cron every ___ minutes | | Users the stand-in covers | | Tell the assistant the values. Ticket 5 then adds the two bind mounts to `compose.yaml` (source read-write, processed read-only) and the two path variables to `.env.example`. ## Clean up Delete the two folders (and unmount the share, if any). The stand-in leaves nothing else behind.