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

The return code on the end maintenance API call does not correspond with the info provided in the documentation #35

Open
ArturoQuintana opened this issue Apr 30, 2021 · 2 comments
Assignees

Comments

@ArturoQuintana
Copy link

ArturoQuintana commented Apr 30, 2021

@hdiogenes @ajoaoff @rmotitsuki

It has been tested the API call /maintenance/{mw_id}/end on PATCH with the idea to execute an early end over a maintenance task that is running. Unfortunately, this task does not succeed.
The test code used is as follow:

def test_040_end_mw_on_switch(self):
        # Setup maintenance window data
        start = datetime.now() + timedelta(seconds=60)
        end = start + timedelta(hours=1)
        payload = {
            "description": "mw for test 040",
            "start": start.strftime(TIME_FMT),
            "end": end.strftime(TIME_FMT),
            "items": [
                "00:00:00:00:00:00:00:02"
            ]
        }

        # Request maintenance schema creation, and extract the mw_id
        json_data = self.request_maintenance(payload, False)
        mw_id = json_data["mw_id"]

        time.sleep(10)

        api_url = KYTOS_API + '/maintenance/' + mw_id + '/end'
        request = requests.patch(api_url)
        assert request.status_code == 201`
```
@ajoaoff
Copy link
Collaborator

ajoaoff commented Apr 30, 2021

@ArturoQuintana, you created the maintenance to be started after 60 seconds, but you put a sleep of only 10 seconds, so the maintenance is not yet running at the time you call the API to end it.

@ArturoQuintana ArturoQuintana changed the title We can not end a maintenance that is running The return code on the end maintenance API call does not correspond with the info provided in the documentation May 3, 2021
@ArturoQuintana
Copy link
Author

@ajoaoff, I have modified the code after your observation.
The API code does work, but now I am receiving a 200 response; when should be a 201 following the documentation.

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

No branches or pull requests

2 participants