Skip to content

Add functions to insert pods/containers to the new trees - #381

Draft
Tacklebox wants to merge 1 commit into
oci-trees-structurefrom
oci-trees-c-api
Draft

Add functions to insert pods/containers to the new trees#381
Tacklebox wants to merge 1 commit into
oci-trees-structurefrom
oci-trees-c-api

Conversation

@Tacklebox

Copy link
Copy Markdown
Contributor

Stack created with GitHub Stacks CLIGive Feedback 💬

@biscout42 biscout42 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My main ask if we have unit tests or could we add them?

Comment thread quark.c
if (pod_uid != NULL) {
pod = pod_lookup_by_uid(qq, (char *)pod_uid);
if (pod == NULL)
return (NULL);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Question: how do we usually report errors in C? IMHO this case is kind of pod not found error. WDYT?

Comment thread quark.c
pod->uid = strdup(uid);
if (pod->uid == NULL)
goto fail;
if (name != NULL && (pod->name = strdup(name)) == NULL)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bot says, if we pass name, nsorpahseasNULL, we will have a pod inserted into the tree, which will fail quark_event_dump()`.

Would it make sense to add a guard and reject inserting null values?

Comment thread quark.c

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we have a uni test for quark_pod_create? We could do a round trip test with create / get

Comment thread quark.c
}

struct quark_container *
quark_container_create(struct quark_queue *qq, const char *container_id,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we have a uni test for quark_container_create? We could do a round trip test with create / get

Comment thread quark.c
container->container_id = strdup(container_id);
if (container->container_id == NULL)
goto fail;
if (name != NULL && (container->name = strdup(name)) == NULL)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same here, bot says quark_event_dump() will fail with this fields being NULL. Shall we prevent it?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants