Project

General

Profile

Actions

action #166133

closed

coordination #163919: [epic] Create automation setup for testing Agama

Create installation for full encryption

Added by JERiveraMoya about 2 months ago. Updated about 1 month ago.

Status:
Resolved
Priority:
High
Assignee:
Target version:
-
Start date:
2024-09-02
Due date:
% Done:

0%

Estimated time:

Description

Motivation

Reusuing all that has been created until now for agama in O3 in Devel job group, let's provide a installation with encryption enabling it in the storage section.

Scope

For now without browser in ppc64le and s390x, only for x86_64 and aarch64.

Acceptance criteria

  • AC1: Create page object to handle screens.
  • AC2: Consider to create new test module to boot the encrypted system avoiding to set so many settings with legacy code (in a similar way we did for boot_agama.pm)
  • AC3: Add validation test module to check that the system is really encrypted properly.

Additional information

For, POM check out previous ticket, https://progress.opensuse.org/issues/163946
Current repo is in my fork, but might change name or we will move to another repo depending on progress of the developer with thee basic automation for agama.
https://github.com/jknphy/agama-integration-test-webpack

Actions #1

Updated by lmanfredi about 2 months ago

  • Status changed from Workable to In Progress
Actions #2

Updated by lmanfredi about 2 months ago

For AC1 the proposal is to add the test case inside the bundle like this one:

  it("Storage: enable and evaluate encryption", async function () {    
    // Open storage page
    const selectorLinkStorage: string = "a[href='#/storage']";
    await page.waitForSelector(selectorLinkStorage);
    await page.locator(selectorLinkStorage).click();
    // Open encryption page
    const storage = new StoragePage(page);
    await storage.openEncryption();
    const storageEncryption = new StorageEncryptionPage(page);
    await storageEncryption.encryptWith(agamaPassword);

    // Evaluate encryption
    await storage.assertEncryption();

  });

and define the following POM:
storage-page.ts

import { type Locator, type Page } from "puppeteer-core";
import assert from "node:assert/strict";

export class StoragePage {
    readonly page: Page;
    readonly encryptionEnableButton: string = "button::-p-text(Enable)";
    readonly enabledDiv: string = "div[aria-label='Encryption'] > div > div > div > div > div div::-p-text(enabled)";

    constructor(page: Page) {
        this.page = page;
    }

    async openEncryption() {
        await this.page.locator(this.encryptionEnableButton).click();
    }

    async assertEncryption() {
        const selectorTextEnabled = await this.page.waitForSelector(this.enabledDiv);
        const textEnabled = await selectorTextEnabled?.evaluate(el => el.textContent);
        assert.equal(textEnabled, "enabled");
    }

}

and storage-encryption-page.ts:

import { type Locator, type Page } from "puppeteer-core";

export class StorageEncryptionPage {
    readonly page: Page;
    readonly checkboxEncrypt: string = "label[class='pf-v5-c-switch'] > input[type='checkbox']";
    readonly passworInput: string = "#password";
    readonly passwordConfirmationInput: string = "#passwordConfirmation";
    readonly acceptEncryptionButton: string = "button[form='encryptionSettingsForm']";

    constructor(page: Page) {
        this.page = page;
    }

    async encryptWith(password: string) {
        await this.page.locator(this.checkboxEncrypt).click();
        await this.page.locator(this.passworInput).fill(password);
        await this.page.locator(this.passwordConfirmationInput).fill(password);
        await this.page.locator(this.acceptEncryptionButton).click();
    }

}

For AC2 a temporary workaround to call agama profile import is to run the command inside NodeJs:

const urlProfile = 'https://raw.githubusercontent.com/os-autoinst/os-autoinst-distri-opensuse/master/data/yam/agama/auto/default_tumbleweed.json';

function importAgamaProfile(urlProfile: string) {
  const result = execFileSync(`/usr/bin/agama`, [`profile`, `import`, `${urlProfile}`]);
  console.log(result);  
}
// Import profile
importAgamaProfile(urlProfile);

But the final solution will be to have a openQA Perl module that ran before the Puppeteer test

Actions #4

Updated by lmanfredi about 1 month ago

It seems that Node option --test-name-pattern with two descriptions does not work as expected:
E.g. test.js:

#! /usr/bin/env -S node --test-timeout=10000

const  assert = require( "node:assert/strict");
const { describe, it } = require('node:test');

describe('installation', () => {
  const label = "Label";

  describe('full disk encryption', () => {
    it('test A', () => {
      assert.strictEqual(label, "Label");
    });


    it('test B', () => {
      assert.strictEqual(2, 2);
    });  

  });

  describe('default', () => {
    it('test C', () => {
      assert.strictEqual(1, 1);
    });

    it('test D', () => {
      assert.strictEqual(2, 2);
    });

  });

});

// node --test-name-pattern="installation full disk encryption" test.js
// node --test-name-pattern="full disk encryption" test.js

For this reason I am going to use a separate bundle for full encryption installation.

Actions #5

Updated by lmanfredi about 1 month ago

Merged os-autoinst-distri-opensuse PR#20190

Actions #6

Updated by JERiveraMoya about 1 month ago

PR Merged.
Please check that works in production.

Actions #7

Updated by JERiveraMoya about 1 month ago

We could closed this one and remaining part is to boot the system with encryption, perhaps using new fresh code instead of using legacy one.
To be discussed in review.

Actions #8

Updated by lmanfredi about 1 month ago

Create needle with tag grub2 : grub_test-grub2-agama-encrypt-20240925.png

Actions #9

Updated by JERiveraMoya about 1 month ago

  • Status changed from In Progress to Resolved

lmanfredi wrote in #note-8:

Create needle with tag grub2 : grub_test-grub2-agama-encrypt-20240925.png

Needle needs to be recreated and setting for encryption needs to be add to test suite.
Let's resolve this ticket and adapt the above, and for the remaining part file another ticket if any.

Actions

Also available in: Atom PDF