Skip to content

Commit a752d90

Browse files
committed
RHINENG-20967: test candlepin environment assignment
1 parent 5f10625 commit a752d90

2 files changed

Lines changed: 34 additions & 6 deletions

File tree

docker-compose.test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ services:
4343
env_file:
4444
- ./conf/common.env
4545
- ./conf/platform.env
46+
- ./conf/gorun.env
4647
command: ./dev/scripts/docker-compose-entrypoint.sh platform
4748
restart: unless-stopped
4849
ports:

listener/upload_test.go

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,12 @@ func TestHostTemplateRhsmReporter(t *testing.T) {
440440
ID: id,
441441
Reporter: rhsmReporter,
442442
SystemProfile: inventory.SystemProfile{
443-
Rhsm: inventory.Rhsm{
444-
Environments: []string{"99900000000000000000000000000001", "99900000000000000000000000000002"},
445-
},
443+
ConsumerID: "00000000-0000-0000-0000-000000000001",
444+
YumRepos: &[]inventory.YumRepo{{
445+
ID: "base",
446+
Enabled: true,
447+
BaseURL: "https://cert.console.example.com/api/pulp-content/abcdef/templates/" +
448+
"12345678-90ab-cdef-1234-567890abcdef/content/dist/rhel9/$releasever/x86_64/baseos/os"}},
446449
},
447450
}
448451

@@ -462,13 +465,37 @@ func TestHostTemplatePuptoo(t *testing.T) {
462465
Reporter: puptooReporter,
463466
SystemProfile: inventory.SystemProfile{
464467
ConsumerID: "00000000-0000-0000-0000-000000000002",
465-
Rhsm: inventory.Rhsm{
466-
Environments: []string{"99900000000000000000000000000002"},
467-
},
468+
YumRepos: &[]inventory.YumRepo{{
469+
ID: "base",
470+
Enabled: true,
471+
BaseURL: "https://cert.console.example.com/api/pulp-content/abcdef/templates/" +
472+
"12345678-90ab-cdef-1234-567890abcdef/content/dist/rhel9/$releasever/x86_64/baseos/os"}},
468473
},
469474
}
470475

471476
templateID := hostTemplate(database.DB, accountID, host)
472477
assert.NotNil(t, templateID)
473478
assert.Equal(t, int64(2), *templateID)
474479
}
480+
481+
func TestNoHostTemplate(t *testing.T) {
482+
utils.SkipWithoutDB(t)
483+
core.SetupTestEnvironment()
484+
configure()
485+
486+
accountID := int(1)
487+
host := &Host{
488+
ID: id,
489+
Reporter: puptooReporter,
490+
SystemProfile: inventory.SystemProfile{
491+
ConsumerID: "00000000-0000-0000-0000-000000000002",
492+
YumRepos: &[]inventory.YumRepo{{
493+
ID: "base",
494+
Enabled: true,
495+
BaseURL: "https://cdn.example.com/content/dist/rhel9/$releasever/x86_64/baseos/os"}},
496+
},
497+
}
498+
499+
templateID := hostTemplate(database.DB, accountID, host)
500+
assert.Nil(t, templateID)
501+
}

0 commit comments

Comments
 (0)