Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration test for reading Pods via http & file #5785

Merged

Conversation

wojtek-t
Copy link
Member

Extend hack/integration_test.sh to test reading Pods (in addition to ContainerManifest) via Kubelet http & file channel.

Fixes #3372
It's also part of #5630

cc @vmarmol @yujuhong @bgrant0607

@@ -855,6 +879,29 @@ func ServeCachedManifestFile() (servingAddress string) {
}

const (
testManifestFile = `kind: Pod
Copy link
Member Author

Choose a reason for hiding this comment

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

This change isn't exactly what we would like to do, because it only tests whether reading Pods works.
Do you have any suggestions how to make it test both scenarios (without significant changes to this file)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is anything using this const?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes - it is used by ServeCachedManifestFile.
What I would ideally like to do is to have "two modes" - one testing reading pods from http given by manifest, and the other one reading pods from http given PodSpec. But currently all tests are using the same "http endpoint".

Copy link
Member Author

Choose a reason for hiding this comment

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

FYI: I found an easy way to test both modes (i.e. reading both Pods and ContainerManifest from http channel). Basically, in the integration test we have two Kubelets, so I did small changes that the first one is reading Pods from http, and the second is reading ContainerManifest from http.
I hope that you're fine with that.

@@ -306,37 +306,61 @@ func podRunning(c *client.Client, podNamespace string, podID string) wait.Condit
}

func runStaticPodTest(c *client.Client, configFilePath string) {
manifest := `version: v1beta2
id: static-pod
hostname, _ := os.Hostname()
Copy link
Contributor

Choose a reason for hiding this comment

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

@smarterclayton just removed os.Hostname from the integration tests because it was causing issues running them on a mac.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also we should be using the name from the kubelet (in the integration test, it is always "localhost" for files)

----- Original Message -----

@@ -306,37 +306,61 @@ func podRunning(c *client.Client, podNamespace
string, podID string) wait.Condit
}

func runStaticPodTest(c *client.Client, configFilePath string) {

  • manifest := `version: v1beta2
    -id: static-pod
  • hostname, _ := os.Hostname()

@smarterclayton just removed os.Hostname from the integration tests because
it was causing issues running them on a mac.


Reply to this email directly or view it on GitHub:
https://github.com/GoogleCloudPlatform/kubernetes/pull/5785/files#r26958255

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes - I've seen that, but thanks for notifying. I will fix that tomorrow.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@vmarmol
Copy link
Contributor

vmarmol commented Mar 23, 2015

@wojtek-t this is already strictly better than what we have today. We can probably add a Get() to the pods and verify the fields in the pod if you want to also test the values.

@wojtek-t
Copy link
Member Author

I have no idea how this worked yesterday. Basically, I rebased the PR today morning and it stopped working. But the real problem is that it couldn't parsed the pods in the format that I used yesterday. I spent an hour fighting with it but it didn't lead me anywhere and I gave up.

I changed the data format that I was using and now it seems to work.

PTAL

@wojtek-t wojtek-t force-pushed the check_reading_pods_in_integration branch from b29973a to f80cac1 Compare March 24, 2015 11:08
@smarterclayton
Copy link
Contributor

When the YAML change landed trailing commas became invalid JSON (the strict Go JSON parser does not allow them, the looser YAML parser did)

----- Original Message -----

I have no idea how this worked yesterday. Basically, I rebased the PR today
morning and it stopped working. But the real problem is that it couldn't
parsed the pods in the format that I used yesterday. I spent an hour
fighting with it but it didn't lead me anywhere and I gave up.

I changed the data format that I was using and now it seems to work.

PTAL


Reply to this email directly or view it on GitHub:
#5785 (comment)

@wojtek-t
Copy link
Member Author

My problems weren't related to commas. I had the following yaml:
kind: Pod
apiversion: v1beta3
metadata:
name: static-pod-from-spec
spec:
containers:
- name: static-container
image: kubernetes/pause
and the error I was getting was: "couldn't get version/kind: invalid character 'k' looking for beginning of value"

Anyway, I think that the current version also tests what we wanted to test.

@smarterclayton
Copy link
Contributor

We don't support YAML anymore from the API :)

----- Original Message -----

My problems weren't related to commas. I had the following yaml:
kind: Pod
apiversion: v1beta3
metadata:
name: static-pod-from-spec
spec:
containers:
- name: static-container
image: kubernetes/pause
and the error I was getting was: "couldn't get version/kind: invalid
character 'k' looking for beginning of value"

Anyway, I think that the current version also tests what we wanted to test.


Reply to this email directly or view it on GitHub:
#5785 (comment)

@wojtek-t
Copy link
Member Author

Thanks @smarterclayton - I know there are plans for it, but didn't know that it already happened.
Can you point me to the PR that disabled it?

@vmarmol
Copy link
Contributor

vmarmol commented Mar 24, 2015

@wojtek-t #5533

@wojtek-t
Copy link
Member Author

Thanks - that was merged yesterday and that explains why it worked for me yesterday.

Anyway, it seems that the current version is exactly what we would like to test.

@wojtek-t
Copy link
Member Author

BTW - I looked into the test failure and it seems that it's a flake that is unrelated to my changes.

@vmarmol
Copy link
Contributor

vmarmol commented Mar 24, 2015

Thanks @wojtek-t I kicked off Travis and will merge when that is green :) it's half-way through

vmarmol added a commit that referenced this pull request Mar 24, 2015
Integration test for reading Pods via http & file
@vmarmol vmarmol merged commit 940f4b5 into kubernetes:master Mar 24, 2015
@wojtek-t
Copy link
Member Author

Thanks!

@smarterclayton
Copy link
Contributor

#5533

On Mar 24, 2015, at 10:41 AM, Wojciech Tyczynski notifications@github.com wrote:

Thanks @smarterclayton - I know there are plans for it, but didn't know that it already happened.
Can you point me to the PR that disabled it?


Reply to this email directly or view it on GitHub.

@wojtek-t wojtek-t deleted the check_reading_pods_in_integration branch March 27, 2015 10:23
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.

Kubelet config/file should read Pod
5 participants