Skip to content

Commit

Permalink
more suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
admd committed Feb 21, 2020
1 parent 9931411 commit 483e566
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,9 @@ public void testRegisterMinionWithoutActivationKey() throws Exception {
public void testRegisterMinionWithInvalidActivationKeyNoSyncProducts() throws Exception {
ChannelFamily channelFamily = createTestChannelFamily();
SUSEProduct product = SUSEProductTestUtils.createTestSUSEProduct(channelFamily);
MinionStartupGrains.SuseManagerGrain suseManagerGrain = new MinionStartupGrains.SuseManagerGrain(Optional.of("non-existent-key"));
MinionStartupGrains minionStartUpGrains = new MinionStartupGrains.MinionStartupGrainsBuilder()
.machineId(MACHINE_ID).saltbootInitrd(false)
.machineId(MACHINE_ID).saltbootInitrd(false).susemanagerGrain(suseManagerGrain)
.createMinionStartUpGrains();
executeTest(
(saltServiceMock, key) -> new Expectations() {{
Expand Down Expand Up @@ -628,8 +629,9 @@ public void testRegisterMinionWithInvalidActivationKey()
Channel baseChannelX8664 = setupBaseAndRequiredChannels(channelFamily, product);
ConfigChannel cfgChannel = ConfigTestUtils.createConfigChannel(user.getOrg(),
"Config channel 1", "config-channel-1");
MinionStartupGrains.SuseManagerGrain suseManagerGrain = new MinionStartupGrains.SuseManagerGrain(Optional.of("non-existent-key"));
MinionStartupGrains minionStartUpGrains = new MinionStartupGrains.MinionStartupGrainsBuilder()
.machineId(MACHINE_ID).saltbootInitrd(false)
.machineId(MACHINE_ID).saltbootInitrd(false).susemanagerGrain(suseManagerGrain)
.createMinionStartUpGrains();
executeTest(
(saltServiceMock, key) -> new Expectations() {{
Expand Down Expand Up @@ -691,15 +693,16 @@ public void testRegisterMinionWithActivationKey() throws Exception {
ConfigChannel cfgChannel = ConfigTestUtils.createConfigChannel(user.getOrg(),
"Config channel 1", "config-channel-1");
HibernateFactory.getSession().flush();
MinionStartupGrains minionStartUpGrains = new MinionStartupGrains.MinionStartupGrainsBuilder()
.machineId(MACHINE_ID).saltbootInitrd(false)
.createMinionStartUpGrains();
executeTest(
(saltServiceMock, key) -> new Expectations() {{
allowing(saltServiceMock).getMasterHostname(MINION_ID);
will(returnValue(Optional.of(MINION_ID)));
allowing(saltServiceMock).getMachineId(MINION_ID);
will(returnValue(Optional.of(MACHINE_ID)));
MinionStartupGrains.SuseManagerGrain suseManagerGrain = new MinionStartupGrains.SuseManagerGrain(Optional.of(key));
MinionStartupGrains minionStartUpGrains = new MinionStartupGrains.MinionStartupGrainsBuilder()
.machineId(MACHINE_ID).saltbootInitrd(false).susemanagerGrain(suseManagerGrain)
.createMinionStartUpGrains();
allowing(saltServiceMock).getGrains(with(any(String.class)), with(any(TypeToken.class)),with(any(String[].class)));
will(returnValue(Optional.of(minionStartUpGrains)));
allowing(saltServiceMock).syncGrains(with(any(MinionList.class)));
Expand Down

0 comments on commit 483e566

Please sign in to comment.