Skip to content

Commit

Permalink
fixup! move to osbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
mvo5 committed Dec 4, 2024
1 parent 3c50eb5 commit 0d17683
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package osbuildmonitor
package osbuild

type (
StatusJSON = statusJSON
Expand Down
2 changes: 1 addition & 1 deletion pkg/osbuildmonitor/monitor.go → pkg/osbuild/monitor.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package osbuildmonitor
package osbuild

import (
"bufio"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package osbuildmonitor_test
package osbuild_test

import (
"encoding/json"
"testing"

"github.com/stretchr/testify/assert"

"github.com/osbuild/images/pkg/osbuildmonitor"
"github.com/osbuild/images/pkg/osbuild"
)

const osbuildMonitorJSON_1 = `
Expand Down Expand Up @@ -40,7 +40,7 @@ const osbuildMonitorJSON_1 = `
}`

func TestOsbuildStatusNestingWorks(t *testing.T) {
var status osbuildmonitor.StatusJSON
var status osbuild.StatusJSON

err := json.Unmarshal([]byte(osbuildMonitorJSON_1), &status)
assert.NoError(t, err)
Expand Down
32 changes: 16 additions & 16 deletions pkg/osbuildmonitor/monitor_test.go → pkg/osbuild/monitor_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package osbuildmonitor_test
package osbuild_test

import (
"bytes"
Expand All @@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/osbuild/images/pkg/osbuildmonitor"
"github.com/osbuild/images/pkg/osbuild"
)

const osbuildMonitorLines_curl = `{"message": "source/org.osbuild.curl (org.osbuild.curl): Downloaded https://rpmrepo.osbuild.org/v2/mirror/public/f39/f39-x86_64-fedora-20231109/Packages/k/kpartx-0.9.5-2.fc39.x86_64.rpm\n", "context": {"origin": "org.osbuild", "pipeline": {"name": "source org.osbuild.curl", "id": "598849389c35f93efe2412446f5ca6919434417b9bcea040ea5f9203de81db2c", "stage": {}}, "id": "7355d3857aa5c7b3a0c476c13d4b242a625fe190f2e7796df2335f3a34429db3"}, "progress": {"name": "pipelines/sources", "total": 4, "done": 0}, "timestamp": 1731589338.8252223}
Expand All @@ -22,13 +22,13 @@ func TestScannerSimple(t *testing.T) {
ts3 := 1731589407.0338647 * 1000

r := bytes.NewBufferString(osbuildMonitorLines_curl)
scanner := osbuildmonitor.NewStatusScanner(r)
scanner := osbuild.NewStatusScanner(r)
// first line
st, err := scanner.Status()
assert.NoError(t, err)
assert.Equal(t, &osbuildmonitor.Status{
assert.Equal(t, &osbuild.Status{
Trace: "source/org.osbuild.curl (org.osbuild.curl): Downloaded https://rpmrepo.osbuild.org/v2/mirror/public/f39/f39-x86_64-fedora-20231109/Packages/k/kpartx-0.9.5-2.fc39.x86_64.rpm",
Progress: &osbuildmonitor.Progress{
Progress: &osbuild.Progress{
Done: 0,
Total: 4,
Message: "Pipeline source org.osbuild.curl",
Expand All @@ -38,9 +38,9 @@ func TestScannerSimple(t *testing.T) {
// second line
st, err = scanner.Status()
assert.NoError(t, err)
assert.Equal(t, &osbuildmonitor.Status{
assert.Equal(t, &osbuild.Status{
Trace: "source/org.osbuild.curl (org.osbuild.curl): Downloaded https://rpmrepo.osbuild.org/v2/mirror/public/f39/f39-x86_64-fedora-20231109/Packages/l/langpacks-fonts-en-4.0-9.fc39.noarch.rpm",
Progress: &osbuildmonitor.Progress{
Progress: &osbuild.Progress{
Done: 0,
Total: 4,
Message: "Pipeline source org.osbuild.curl",
Expand All @@ -50,13 +50,13 @@ func TestScannerSimple(t *testing.T) {
// third line
st, err = scanner.Status()
assert.NoError(t, err)
assert.Equal(t, &osbuildmonitor.Status{
assert.Equal(t, &osbuild.Status{
Message: "Starting pipeline build",
Progress: &osbuildmonitor.Progress{
Progress: &osbuild.Progress{
Done: 1,
Total: 4,
Message: "Pipeline build",
SubProgress: &osbuildmonitor.Progress{
SubProgress: &osbuild.Progress{
Message: "Stage ",
Done: 0,
Total: 2,
Expand All @@ -77,20 +77,20 @@ func TestScannerSubprogress(t *testing.T) {
ts1 := 1731600115.14839 * 1000

r := bytes.NewBufferString(osbuildMontiorLines_subprogress)
scanner := osbuildmonitor.NewStatusScanner(r)
scanner := osbuild.NewStatusScanner(r)
st, err := scanner.Status()
assert.NoError(t, err)
assert.Equal(t, &osbuildmonitor.Status{
assert.Equal(t, &osbuild.Status{
Message: "Starting module org.osbuild.rpm",
Progress: &osbuildmonitor.Progress{
Progress: &osbuild.Progress{
Done: 1,
Total: 4,
Message: "Pipeline build",
SubProgress: &osbuildmonitor.Progress{
SubProgress: &osbuild.Progress{
Done: 2,
Total: 8,
Message: "Stage org.osbuild.rpm",
SubProgress: &osbuildmonitor.Progress{
SubProgress: &osbuild.Progress{
Done: 4,
Total: 16,
Message: "Stage org.osbuild.rpm",
Expand All @@ -106,7 +106,7 @@ func TestScannerSmoke(t *testing.T) {
require.NoError(t, err)
defer f.Close()

scanner := osbuildmonitor.NewStatusScanner(f)
scanner := osbuild.NewStatusScanner(f)
for {
st, err := scanner.Status()
assert.NoError(t, err)
Expand Down

0 comments on commit 0d17683

Please sign in to comment.