Skip to content

many: use dot graph functionality in tests and "snap debug"#16675

Open
andrewphelpsj wants to merge 9 commits intocanonical:masterfrom
andrewphelpsj:split/state-dot-plus
Open

many: use dot graph functionality in tests and "snap debug"#16675
andrewphelpsj wants to merge 9 commits intocanonical:masterfrom
andrewphelpsj:split/state-dot-plus

Conversation

@andrewphelpsj
Copy link
Member

@andrewphelpsj andrewphelpsj commented Feb 25, 2026

This change enables us to integrate dot graph creation into test suites that do not link their tasks to changes.

Additionally, swap out the "snap debug" impl for the implementation from dot.

I know dottest probably isn't the best package name, open to alternatives. I didn't just put that stuff in dot, since it seems strange to import check there. But maybe that is fine?

@github-actions github-actions bot added the Needs Documentation -auto- Label automatically added which indicates the change needs documentation label Feb 25, 2026
@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

❌ Patch coverage is 56.62651% with 72 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.59%. Comparing base (80abbf6) to head (a0b55f4).
⚠️ Report is 14 commits behind head on master.

Files with missing lines Patch % Lines
overlord/dot/dottest/dottest.go 10.81% 33 Missing ⚠️
overlord/dot/dot.go 67.36% 22 Missing and 9 partials ⚠️
overlord/state/dot/dot.go 63.63% 5 Missing and 3 partials ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master   #16675    +/-   ##
========================================
  Coverage   77.58%   77.59%            
========================================
  Files        1345     1350     +5     
  Lines      186890   187241   +351     
  Branches     2446     2446            
========================================
+ Hits       145002   145286   +284     
- Misses      33126    33171    +45     
- Partials     8762     8784    +22     
Flag Coverage Δ
unittests 77.59% <56.62%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link

github-actions bot commented Feb 25, 2026

Sat Feb 28 00:20:41 UTC 2026
The following results are from: https://github.com/canonical/snapd/actions/runs/22499764719

Failures:

Preparing:

  • openstack:debian-sid-64:tests/main/
  • openstack:debian-sid-64:tests/unit/
  • openstack:debian-sid-64:tests/completion/
  • openstack:debian-sid-64:tests/main/
  • openstack:debian-sid-64:tests/main/
  • openstack:debian-sid-64:tests/unit/
  • openstack:debian-sid-64:tests/unit/
  • openstack:debian-sid-64:tests/smoke/
  • openstack:debian-sid-64:tests/regression/
  • openstack:debian-sid-64:tests/regression/
  • openstack:debian-sid-64:tests/regression/
  • openstack:debian-sid-64:tests/smoke/
  • openstack:debian-sid-64:tests/smoke/
  • openstack:debian-sid-64:tests/regression/
  • openstack:opensuse-tumbleweed-selinux-64:
  • openstack:opensuse-tumbleweed-64:
  • openstack:opensuse-tumbleweed-selinux-64:
  • openstack:opensuse-tumbleweed-64:
  • openstack:opensuse-tumbleweed-selinux-64:
  • openstack:opensuse-tumbleweed-selinux-64:
  • openstack:opensuse-tumbleweed-selinux-64:
  • openstack:opensuse-tumbleweed-64:
  • openstack:opensuse-tumbleweed-64:
  • openstack:opensuse-tumbleweed-64:
  • openstack:opensuse-tumbleweed-selinux-64:
  • openstack:opensuse-tumbleweed-64:
  • openstack-arm:ubuntu-24.04-arm-64:tests/main/
  • openstack-arm:ubuntu-24.04-arm-64:tests/regression/
  • openstack-arm:ubuntu-24.04-arm-64:tests/completion/
  • openstack-arm:ubuntu-24.04-arm-64:tests/smoke/
  • openstack-arm:ubuntu-24.04-arm-64:tests/upgrade/
  • openstack-arm:ubuntu-24.04-arm-64:tests/fips-deb/
  • openstack-arm:ubuntu-24.04-arm-64:tests/unit/
  • openstack:ubuntu-18.04-64:tests/regression/lp-1871652

Executing:

  • openstack:amazon-linux-2-64:tests/completion/indirect:plain_plusdirs
  • openstack:fedora-42-64:tests/main/snap-run-gdbserver:local_ip
  • garden:ubuntu-25.10-64:tests/main/snapd-snap:lxd
  • openstack-arm:ubuntu-24.04-arm-64:tests/unit/go:clang
  • openstack-arm:ubuntu-24.04-arm-64:tests/unit/go:gcc
  • openstack-arm:ubuntu-core-24-arm-64:tests/core/kernel-base-gadget-pair-single-reboot-failover:kernel_gadget
  • openstack-arm:ubuntu-core-24-arm-64:tests/main/snap-user-service-upgrade-failure
  • openstack-arm:ubuntu-core-24-arm-64:tests/main/snap-services
  • openstack:ubuntu-26.04-64:tests/main/apparmor-prompting-snapd-startup
  • openstack:ubuntu-26.04-64:tests/main/desktop-portal-open-file
  • openstack:ubuntu-26.04-64:tests/main/snapd-state
  • openstack:ubuntu-26.04-64:tests/main/desktop-portal-filechooser
  • openstack:ubuntu-26.04-64:tests/main/server-snap:pythonServer
  • openstack:ubuntu-26.04-64:tests/main/try
  • openstack:ubuntu-26.04-64:tests/main/server-snap:goServer
  • openstack:ubuntu-26.04-64:tests/main/interfaces-firewall-control
  • openstack:ubuntu-26.04-64:tests/main/upgrade-from-release
  • openstack:ubuntu-26.04-64:tests/main/xdg-open-portal
  • openstack:ubuntu-26.04-64:tests/main/desktop-portal-open-uri
  • openstack:ubuntu-26.04-64:tests/main/interfaces-network-bind
  • openstack:ubuntu-26.04-64:tests/main/interfaces-network
  • openstack:ubuntu-26.04-64:tests/main/apparmor-prompting-flag-restart
  • openstack:ubuntu-16.04-64:tests/unit/go:static
  • openstack:ubuntu-16.04-64:tests/main/proxy-no-core

Restoring:

  • openstack:opensuse-tumbleweed-64:
  • openstack:opensuse-tumbleweed-selinux-64:
  • openstack:opensuse-tumbleweed-selinux-64:
  • openstack:opensuse-tumbleweed-64:
  • openstack:opensuse-tumbleweed-selinux-64:
  • openstack:opensuse-tumbleweed-selinux-64:
  • openstack:opensuse-tumbleweed-selinux-64:
  • openstack:opensuse-tumbleweed-64:
  • openstack:opensuse-tumbleweed-64:
  • openstack:opensuse-tumbleweed-64:
  • openstack:opensuse-tumbleweed-selinux-64:
  • openstack:opensuse-tumbleweed-64:
  • openstack-arm:ubuntu-core-24-arm-64:tests/core/kernel-base-gadget-pair-single-reboot-failover:kernel_gadget
  • openstack-arm:ubuntu-core-24-arm-64:tests/core/
  • openstack-arm:ubuntu-core-24-arm-64:
  • openstack:ubuntu-26.04-64:tests/main/apparmor-prompting-snapd-startup
  • openstack:ubuntu-26.04-64:tests/main/
  • openstack:ubuntu-26.04-64:
  • openstack:ubuntu-26.04-64:tests/main/apparmor-prompting-flag-restart
  • openstack:ubuntu-26.04-64:tests/main/
  • openstack:ubuntu-26.04-64:
  • openstack:ubuntu-18.04-64:tests/main/snap-mgmt
  • openstack:ubuntu-18.04-64:tests/regression/lp-1871652

Skipped tests from snapd-testing-skip

  • openstack-arm:ubuntu-24.04-arm-64:tests/main/i18n
  • openstack-arm:ubuntu-core-24-arm-64:tests/main/i18n
  • openstack:debian-sid-64:tests/main/interfaces-network-status-classic
  • openstack:ubuntu-24.04-64:tests/main/i18n
  • openstack:ubuntu-26.04-64:tests/main/i18n

Copy link
Contributor

@bboozzoo bboozzoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@andrewphelpsj andrewphelpsj added the Auto rerun spread Auto reruns spread up to 4 times in non-draft PRs w/ >=1 approval and <20 fails in any fund. system label Feb 26, 2026
Copy link
Contributor

@pedronis pedronis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did a pass, some terminology/labeling questions

I also wonder if we should use " []" for consistency for the graphs ?

}

// AllTasksForTests returns all tasks currently known to the state,
// including tasks not linked to any change.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is linked the right word? do we use task linked to change in other places? belonging to perhaps?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use this language in various State methods. For example, the State.Task doc comment:

// Task returns the task for the given ID if the task has been linked to a change.

if err := t.Get("hook-setup", &hooksup); err != nil {
return "", err
}
return fmt.Sprintf("[%s] %s:run-hook[%s]", t.ID(), hooksup.Snap, hooksup.Hook), nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did I have this way in the original code? should the ID perhaps go at the ends of labels?

return
}

chg := st.NewChange("unlinked-tasks", c.TestName())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tasks w/o Change

@andrewphelpsj
Copy link
Member Author

Addressed these comments. Sorry, I also rebased against master, so just the last 3 commits are new.

Copy link
Contributor

@pedronis pedronis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the changes, wondering/nitpick


chg := st.NewChange("unlinked-tasks", c.TestName())
for _, t := range unlinked {
chg := st.NewChange("tasks-without-change", c.TestName())
Copy link
Contributor

@pedronis pedronis Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we check the form of that string? otherwise I was really planning to make it not look like a real kind, "tasks w/o change"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having the / in there makes it a bit annoying, since we turn that into a path ultimately. But let me know if this is a blocker for you and I'll figure something out.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change the way we compute the filename to something vaguely like:

	tags := []string{"my-refresh [1]", "MyTest"}
	var frags []string
	for _, t := range tags {
		f := strings.Map(func(r rune) rune {
			if unicode.IsLetter(r) || unicode.IsDigit(r) || r == '-' {
				return r
			}
			return ' '
		}, t)
		f = strings.Join(strings.Fields(f), "_")
		frags = append(frags, f)
	}
	fn := strings.Join(frags, "-")

we could be less strict about what we pass through

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto rerun spread Auto reruns spread up to 4 times in non-draft PRs w/ >=1 approval and <20 fails in any fund. system Needs Documentation -auto- Label automatically added which indicates the change needs documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants