Skip to content

slugify() in snapd_resource.py breaks checkbox-newparis slot-check tests #1745

@nancyc12

Description

@nancyc12

Bug Description

The new-introduced slugify() function breaks the slot-check tests in checkbox-newparis, including

  • kmc-uno-420-gadget/slot-check/serial-port-1
  • kmc-uno-420-gadget/slot-check/serial-port-2
  • kmc-uno-420-gadget/slot-check/serial-port-3

The interface looks good with snap command.

$ snap interface serial-port --attrs
name:          serial-port
summary:       allows accessing a specific serial port
documentation: https://snapcraft.io/docs/serial-port-interface
plugs:
  - checkbox-newparis
slots:
  - kmc-uno-420-gadget:serial-port-1:
      path:                 /dev/serial-port-1
      usb-interface-number: 0
      usb-product:          24593
      usb-vendor:           1027
  - kmc-uno-420-gadget:serial-port-2:
      path:                 /dev/serial-port-2
      usb-interface-number: 1
      usb-product:          24593
      usb-vendor:           1027
  - kmc-uno-420-gadget:serial-port-3:
      path:                 /dev/serial-port-3
      usb-interface-number: 2
      usb-product:          24593
      usb-vendor:           1027

However, the slugify() turns the attr names to strings like attr_usb-interface-number instead of attr_usb_interface_number which is expected by the test job.

Need someone with a better understanding of the impact to determine whether the fix should be landed on slugify() or checkbox-newparis test job.

Cert-blocker Test Case

  • cert-blocker

To Reproduce

  1. Launch checkbox-newparis with checkbox-newparis.checkbox-cli run com.canonical.qa.newparis::kmc-uno-420-gadget/slot-check/serial-port-1

Expected Result

Job passed

Actual Result

-----------------[ Check ttysp0 slot provided by gadget snap ]------------------
ID: com.canonical.qa.newparis::kmc-uno-420-gadget/slot-check/serial-port-1
Category: com.canonical.certification::gadget
Job cannot be started because:
 - resource expression "slot.snap == 'kmc-uno-420-gadget' and slot.interface == 'serial-port' and slot.type == 'slot' and slot.name == 'serial-port-1' and int(slot.attr_usb_vendor) == 0x0403 and int(slot.attr_usb_product) == 0x6011 and slot.attr_usb_interface_number == '0' and slot.attr_path == '/dev/serial-port-1'" evaluates to false
Outcome: job failed

Environment

  • UC20
  • checkbox-newparis 1.3 (28)
  • checkbox20 4.3.0-dev71 (2333)

Relevant log output

  • Test passed with Checkbox 4.2.0-dev160 (log)
  • Test failed with Checkbox 4.3.0-dev71 (log)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions