Skip to content

Commit

Permalink
update dos games test to decrease reliance on dockerhub
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Abro <[email protected]>
  • Loading branch information
AustinAbro321 committed Aug 6, 2024
1 parent 5f0f8de commit 48e9530
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 50 deletions.
2 changes: 1 addition & 1 deletion examples/composable-packages/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ components:
# default: false # the initial value overrides the child component
import:
# The URL to the skeleton package containing this component's package definition
url: oci://🦄/dos-games:1.0.0
url: oci://ghcr.io/zarf-dev/dos-games:1.0.0
# Example optional custom name to point to in the imported package (default is to use this component's name)
name: baseline
# Un'name'd Zarf primitives will be appended to the end of the primitive's list for that component.
Expand Down
14 changes: 2 additions & 12 deletions examples/dos-games/image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,9 @@ RUN wget https://js-dos.com/6.22/current/js-dos.js && \
wget https://js-dos.com/6.22/current/wdosbox.js && \
wget https://js-dos.com/6.22/current/wdosbox.wasm.js

RUN wget -O aladdin.zip "https://web.archive.org/web/20190303222445if_/https://www.dosgames.com/files/DOSBOX_ALADDIN.ZIP"
RUN wget -O doom.zip "https://archive.org/download/DoomsharewareEpisode/doom.ZIP"
RUN wget -O mario-brothers.zip "https://image.dosgamesarchive.com/games/mario-bro.zip"
RUN wget -O prince-of-persia.zip "https://web.archive.org/web/20181030180256if_/http://image.dosgamesarchive.com/games/pop1.zip"
RUN wget -O quake.zip "https://web.archive.org/web/20190303223506if_/https://www.dosgames.com/files/DOSBOX_QUAKE.ZIP"
RUN wget -O warcraft-ii.zip "https://web.archive.org/web/20190303222732if_/https://www.dosgames.com/files/DOSBOX_WAR2.ZIP"

RUN wget -O aladdin.png "https://image.dosgamesarchive.com/screenshots/aladdem-4.png" && \
wget -O doom.png "https://image.dosgamesarchive.com/screenshots/doom01.png" && \
wget -O mario-brothers.png "https://image.dosgamesarchive.com/screenshots/marionl-6.png" && \
wget -O prince-of-persia.png "https://image.dosgamesarchive.com/screenshots/prince102.png" && \
wget -O quake.png "https://image.dosgamesarchive.com/screenshots/quake13.png" && \
wget -O warcraft-ii.png "https://image.dosgamesarchive.com/screenshots/war2demo3.png"
RUN wget -O doom.png "https://image.dosgamesarchive.com/screenshots/doom01.png"


COPY index.html .
Expand All @@ -34,4 +24,4 @@ COPY --from=0 /binary /binary
WORKDIR /site
ENTRYPOINT ["/binary/darkhttpd", "/site", "--port", "8000"]

# docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag defenseunicorns/zarf-game:multi-tile .
# docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/zarf-dev/zarf-game:0.0.1 .
22 changes: 3 additions & 19 deletions examples/dos-games/image/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@
}

.column img {
margin-top: 8px;
margin-top: 16px;
vertical-align: middle;
width: 100%;
height: auto;
}

/* Responsive layout - makes a two column-layout instead of four columns */
Expand All @@ -70,22 +71,14 @@
}
}
</style>
</style>
</head>

<body>
<canvas id="jsdos" style="display: none;"></canvas>
<script>
const game = location.search.substr(1)
const gamePaths = {
'aladdin': 'ALADDIN.EXE',
'doom': 'DOOM.EXE',
'mario-brothers': 'MARIO.BAT',
'mega-man-x': 'MMXDEMO.EXE',
'prince-of-persia': 'pop1demo.exe',
'quake': 'QUAKE.EXE',
'sim-city-2k': 'SC2000.EXE',
'warcraft-ii': 'WAR2.EXE',
}

if (gamePaths[game]) {
Expand All @@ -101,15 +94,6 @@

<div class="row">
<div class="column">
<a href="?aladdin"><img src="aladdin.png" style="width:100%"></a>
<a href="?doom"><img src="doom.png" style="width:100%"></a>
</div>
<div class="column">
<a href="?mario-brothers"><img src="mario-brothers.png" style="width:100%"></a>
<a href="?prince-of-persia"><img src="prince-of-persia.png" style="width:100%"></a>
</div>
<div class="column">
<a href="?quake"><img src="quake.png" style="width:100%"></a>
<a href="?warcraft-ii"><img src="warcraft-ii.png" style="width:100%"></a>
<a href="?doom"><img src="doom.png" ></a>
</div>
</div>
2 changes: 1 addition & 1 deletion examples/dos-games/manifests/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
spec:
containers:
- name: multi-game
image: "defenseunicorns/zarf-game:multi-tile-dark"
image: ghcr.io/zarf-dev/zarf-game:0.0.1
ports:
- name: http
containerPort: 8000
Expand Down
2 changes: 1 addition & 1 deletion examples/dos-games/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ components:
- manifests/deployment.yaml
- manifests/service.yaml
images:
- defenseunicorns/zarf-game:multi-tile-dark
- ghcr.io/zarf-dev/zarf-game:0.0.1
actions:
onDeploy:
after:
Expand Down
12 changes: 6 additions & 6 deletions src/test/e2e/06_create_sbom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,26 @@ func TestCreateSBOM(t *testing.T) {
require.NoError(t, err, stdOut, stdErr)
require.Contains(t, stdErr, "Creating SBOMs for 1 images and 0 components with files.")
// Test that the game package generates the SBOMs we expect (images only)
require.FileExists(t, filepath.Join(sbomPath, "dos-games", "sbom-viewer-docker.io_defenseunicorns_zarf-game_multi-tile-dark.html"))
require.FileExists(t, filepath.Join(sbomPath, "dos-games", "sbom-viewer-docker.io_defenseunicorns_zarf-game_0.0.1.html"))
require.FileExists(t, filepath.Join(sbomPath, "dos-games", "compare.html"))
require.FileExists(t, filepath.Join(sbomPath, "dos-games", "docker.io_defenseunicorns_zarf-game_multi-tile-dark.json"))
require.FileExists(t, filepath.Join(sbomPath, "dos-games", "docker.io_defenseunicorns_zarf-game_0.0.1.json"))

// Clean the SBOM path so it is force to be recreated
e2e.CleanFiles(sbomPath)

stdOut, stdErr, err = e2e.Zarf(t, "package", "inspect", pkgName, "--sbom-out", sbomPath)
require.NoError(t, err, stdOut, stdErr)
// Test that the game package generates the SBOMs we expect (images only)
_, err = os.ReadFile(filepath.Join(sbomPath, "dos-games", "sbom-viewer-docker.io_defenseunicorns_zarf-game_multi-tile-dark.html"))
_, err = os.ReadFile(filepath.Join(sbomPath, "dos-games", "sbom-viewer-docker.io_defenseunicorns_zarf-game_0.0.1.html"))
require.NoError(t, err)
_, err = os.ReadFile(filepath.Join(sbomPath, "dos-games", "compare.html"))
require.NoError(t, err)
_, err = os.ReadFile(filepath.Join(sbomPath, "dos-games", "docker.io_defenseunicorns_zarf-game_multi-tile-dark.json"))
_, err = os.ReadFile(filepath.Join(sbomPath, "dos-games", "docker.io_defenseunicorns_zarf-game_0.0.1.json"))
require.NoError(t, err)

stdOut, _, err = e2e.Zarf(t, "package", "inspect", pkgName, "--list-images")
require.NoError(t, err)
require.Equal(t, "- defenseunicorns/zarf-game:multi-tile-dark\n", stdOut)
require.Equal(t, "- defenseunicorns/zarf-game:0.0.1\n", stdOut)

// Pull the current zarf binary version to find the corresponding init package
version, stdErr, err := e2e.Zarf(t, "version")
Expand All @@ -54,7 +54,7 @@ func TestCreateSBOM(t *testing.T) {
stdOut, stdErr, err = e2e.Zarf(t, "package", "inspect", initName, "--sbom-out", sbomPath)
require.NoError(t, err, stdOut, stdErr)
// Test that we preserve the filepath
_, err = os.ReadFile(filepath.Join(sbomPath, "dos-games", "sbom-viewer-docker.io_defenseunicorns_zarf-game_multi-tile-dark.html"))
_, err = os.ReadFile(filepath.Join(sbomPath, "dos-games", "sbom-viewer-docker.io_defenseunicorns_zarf-game_0.0.1.html"))
require.NoError(t, err)
// Test that the init package generates the SBOMs we expect (images + component files)
_, err = os.ReadFile(filepath.Join(sbomPath, "init", "sbom-viewer-docker.io_gitea_gitea_1.21.5-rootless.html"))
Expand Down
2 changes: 1 addition & 1 deletion src/test/e2e/09_component_compose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (suite *CompositionSuite) Test_0_ComposabilityExample() {

// Ensure that the action was appended
suite.Contains(stdErr, `
- defenseunicorns/zarf-game:multi-tile-dark
- defenseunicorns/zarf-game:0.0.1
actions:
onDeploy:
before:
Expand Down
2 changes: 1 addition & 1 deletion src/test/e2e/12_lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestLint(t *testing.T) {
// Testing import / compose + variables are working
require.Contains(t, strippedStderr, ".components.[2].images.[3] | Image not pinned with digest - busybox:latest")
// Testing OCI imports get linted
require.Contains(t, strippedStderr, ".components.[0].images.[0] | Image not pinned with digest - defenseunicorns/zarf-game:multi-tile-dark")
require.Contains(t, strippedStderr, ".components.[0].images.[0] | Image not pinned with digest - defenseunicorns/zarf-game:0.0.1")

// Check flavors
require.NotContains(t, strippedStderr, "image-in-bad-flavor-component:unpinned")
Expand Down
2 changes: 1 addition & 1 deletion src/test/packages/12-lint/linted-import/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ components:

- name: oci-games-url
import:
url: oci://🦄/dos-games:1.0.0
url: oci://ghcr.io/zarf-dev/dos-games:1.0.0
name: baseline
2 changes: 1 addition & 1 deletion src/test/packages/12-lint/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ components:

- name: oci-games-url
import:
url: oci://🦄/dos-games:1.0.0
url: oci://ghcr.io/zarf-dev/dos-games:1.0.0
name: baseline

- name: oci-games-url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
spec:
containers:
- name: multi-game
image: "defenseunicorns/zarf-game:multi-tile-dark"
image: "ghcr.io/zarf-dev/zarf-game:0.0.1"
ports:
- name: http
containerPort: 8000
Expand Down
2 changes: 1 addition & 1 deletion src/test/packages/25-evil-dos-games/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ components:
- manifests/evil-deployment.yaml
- manifests/service.yaml
images:
- defenseunicorns/zarf-game:multi-tile-dark
- defenseunicorns/zarf-game:0.0.1
2 changes: 1 addition & 1 deletion src/test/packages/25-manifest-adoption/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
spec:
containers:
- name: multi-game
image: "defenseunicorns/zarf-game:multi-tile-dark"
image: "ghcr.io/zarf-dev/zarf-game:0.0.1"
ports:
- name: http
containerPort: 8000
Expand Down
6 changes: 3 additions & 3 deletions src/test/packages/26-image-dos-games/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ components:
- name: baseline
required: true
images:
- defenseunicorns/zarf-game:multi-tile-dark
- defenseunicorns/zarf-game:multi-tile-dark@sha256:f78e442f0f3eb3e9459b5ae6b1a8fda62f8dfe818112e7d130a4e8ae72b3cbff
- defenseunicorns/zarf-game@sha256:f78e442f0f3eb3e9459b5ae6b1a8fda62f8dfe818112e7d130a4e8ae72b3cbff
- ghcr.io/zarf-dev/zarf-game:0.0.1
- ghcr.io/zarf-dev/zarf-game:0.0.1@sha256:0a44b759e219d9d6f3c7cbbf40c57ede71a1f9bf54da65767c4137be74727662
- ghcr.io/zarf-dev/zarf-game@sha256:0a44b759e219d9d6f3c7cbbf40c57ede71a1f9bf54da65767c4137be74727662

0 comments on commit 48e9530

Please sign in to comment.