Skip to content

Conversation

@per1234
Copy link
Contributor

@per1234 per1234 commented Jul 9, 2025

Although libraries-repository-engine is only used on a Linux machine, development of the project should be possible for contributors using any operating system.

Previously, the "TestRegistryValidation/NonExistentFile" unit test failed when ran on a Windows machine:

Running tool: C:\Users\per\sdk\go1.24.0\bin\go.exe test -timeout 30s -run ^TestRegistryValidation$ github.com/arduino/libraries-repository-engine/internal/command/check-registry

--- FAIL: TestRegistryValidation (0.00s)
    --- FAIL: TestRegistryValidation/NonExistentFile (0.00s)
        e:\git\arduino\libraries-repository-engine\internal\command\check-registry\check-registry_test.go:57:
            	Error Trace:	e:/git/arduino/libraries-repository-engine/internal/command/check-registry/check-registry_test.go:57
            	Error:      	Error message not equal:
            	            	expected: "while loading registry data file: stat testdata/nonexistent.txt: no such file or directory"
            	            	actual  : "while loading registry data file: CreateFile testdata\\nonexistent.txt: The system cannot find the file specified."
            	Test:       	TestRegistryValidation/NonExistentFile
FAIL
FAIL	github.com/arduino/libraries-repository-engine/internal/command/check-registry	0.227s
FAIL

The problem is that the Windows operating system generates a different error message than Linux and the test assertion contained the Linux-specific message content.

The fix is to change the assertion so that it only checks for the presence of a distinctive fragment of the error message which is universal.

Although libraries-repository-engine is only used on a Linux machine, development of the project should be possible for
contributors using any operating system.

Previously, the "TestRegistryValidation/NonExistentFile" unit test failed when ran on a Windows machine:

```
Running tool: C:\Users\per\sdk\go1.24.0\bin\go.exe test -timeout 30s -run ^TestRegistryValidation$ github.com/arduino/libraries-repository-engine/internal/command/check-registry

--- FAIL: TestRegistryValidation (0.00s)
    --- FAIL: TestRegistryValidation/NonExistentFile (0.00s)
        e:\git\arduino\libraries-repository-engine\internal\command\check-registry\check-registry_test.go:57:
            	Error Trace:	e:/git/arduino/libraries-repository-engine/internal/command/check-registry/check-registry_test.go:57
            	Error:      	Error message not equal:
            	            	expected: "while loading registry data file: stat testdata/nonexistent.txt: no such file or directory"
            	            	actual  : "while loading registry data file: CreateFile testdata\\nonexistent.txt: The system cannot find the file specified."
            	Test:       	TestRegistryValidation/NonExistentFile
FAIL
FAIL	github.com/arduino/libraries-repository-engine/internal/command/check-registry	0.227s
FAIL
```

The problem is that the Windows operating system generates a different error message than Linux and the test assertion
contained the Linux-specific message content.

The fix is to change the assertion so that it only checks for the presence of a distinctive fragment of the error
message which is universal.
@per1234 per1234 self-assigned this Jul 9, 2025
@per1234 per1234 added topic: infrastructure Related to project infrastructure os: windows Specific to Windows operating system type: imperfection Perceived defect in any part of project labels Jul 9, 2025
@per1234 per1234 merged commit f2798dc into arduino:main Jul 9, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

os: windows Specific to Windows operating system topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant