mitodl / ocw-hugo-themes

A Hugo theme for building OCW websites
BSD 3-Clause "New" or "Revised" License
5 stars 4 forks source link

Use a single source for test sites' content #1271

Open HussainTaj-arbisoft opened 1 year ago

HussainTaj-arbisoft commented 1 year ago

Description/Context

Our Playwright tests use a set of test sites. These test sites are located on RC as well as inside the ocw-hugo-themes repo, as markdown content. From what we see on RC, we were meant to keep these manually synced.

I believe that changes to the test sites should always be made on RC first. We should remove the need for a manual step, which I believe is the cause of this inconsistency. I propose that we use the GitHub content, created via Studio RC, as the source for the test sites in ocw-hugo-themes.

Plan/Design

To achieve this objective, we will need to perform the following tasks.

I don't know why we initially chose to duplicate the content. I might have missed something, so whoever works on this might need to refine the plan accordingly.

HussainTaj-arbisoft commented 1 year ago

I just realized that the reason why we might duplicate content is to avoid conflicts when two different engineers work on the same set of tests.

In that case, what if instead of storing the entire content we only store the commit hash?

HussainTaj-arbisoft commented 1 year ago

We had a short discussion on this.

The primary challenge with the proposed approach is the occasional DB sync with production. These syncs will end up destroying the studio DB and these test courses.

The current favored approach is to use the themes repo's test site content as the source, instead of the content repo's. To keep them in sync, it is proposed that whenever a change in the themes repo happens, we update the content repos via some workflow.

gumaerc commented 9 months ago

@HussainTaj-arbisoft I know this is an old discussion now, but I thought I'd update it with some new information. The end to end test pipeline has been released for a little while now and is running in RC and production. You are correct in that a database restore will wipe out the test courses, along with the rest of the database, but I think that's not as big of an issue as it might seem.

[^1]: A missing piece here is that the test pipeline pulls site content from the release branch, and there's currently no way to push content up to the release branch without triggering a pipeline and pushing it live. I think what we should do in this case is change the site pipeline definition to look at the OCW_WWW_TEST_SLUG and OCW_COURSE_TEST_SLUG vars and if the current site matches either of them, automatically use the test buckets instead. This would mean we can turn on the UI for the test courses without fear of the content ever being published on the live site.