Skip to content

CI: Fetching schemas via cURL fails #547

@hpoeche

Description

@hpoeche

In our CI we download the schema files from admin-shell-io/aas-specs to use them in the sdk-test job.

- name: Collect schema files from aas-specs
run: |
mkdir -p ./test/adapter/schema
curl -sSL -o ./test/adapter/schema/aasJSONSchema.json https://raw.githubusercontent.com/admin-shell-io/aas-specs/${{ env.AAS_SPECS_RELEASE_TAG }}/schemas/json/aas.json
curl -sSL -o ./test/adapter/schema/aasXMLSchema.xsd https://raw.githubusercontent.com/admin-shell-io/aas-specs/${{ env.AAS_SPECS_RELEASE_TAG }}/schemas/xml/AAS.xsd

For the currently set variable value AAS_SPECS_RELEASE_TAG: "IDTA-01001-3-1-2" these URLs do not exist.
Despite the 404 response code of the HTTP Request cURL finishes with status code 0 and the CI step does not fail.

The sdk tests simply skip the tests, that require the schema files:

class JsonSerializationSchemaTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
if not os.path.exists(JSON_SCHEMA_FILE):
raise unittest.SkipTest(f"JSON Schema does not exist at {JSON_SCHEMA_FILE}, skipping test")

class XMLSerializationSchemaTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
if not os.path.exists(XML_SCHEMA_FILE):
raise unittest.SkipTest(f"XSD schema does not exist at {XML_SCHEMA_FILE}, skipping test")

This explains why this bug stayed unnoticed for so long. To avoid this in future I suggest to

  • correct the URL the schemas are downloaded from
  • add the -f flag to the curl call to exit non-zero on any errors
  • (optionally) rely on a different condition to skip the unittests than existence of the schema files

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggeneralSomething to do with the BaSyx Python SDK repository in general

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions