Skip to content

Replace libcompose by a docker compose wrapper#7822

Merged
ruflin merged 14 commits intoelastic:masterfrom
jsoriano:docker-compose-wrapper
Aug 14, 2018
Merged

Replace libcompose by a docker compose wrapper#7822
ruflin merged 14 commits intoelastic:masterfrom
jsoriano:docker-compose-wrapper

Conversation

@jsoriano
Copy link
Copy Markdown
Member

@jsoriano jsoriano commented Jul 31, 2018

Replace libcompose by a docker compose wrapper to be able to use newer features, and to give a step towards having a unified go-based integration test framework.

Docker compose has multiple implementations, mainly:

  • docker-compose itself (python)
  • libcompose (go)
  • docker swarm services (go)

We are currently using docker-compose and libcompose in tests. docker-compose for python tests, and libcompose for go tests.

libcompose has some problems, it is released as experimental, and its support is quite limited, specially with new features as it only supports till version 2.0 of the compose file format. We are already using docker compose 2.1 version in libbeat, so we cannot have integration tests implemented in go using libcompose.

docker swarm services implementation of docker compose supports more recent file formats, but is limited by the features not supported by docker swarm. It also requires docker swarm, what is not always convenient.

Wrapping docker-compose from go is not ideal, but docker-compose at the moment is the only maintained and complete implementation. The wrapping code is "hidden" behind interfaces, so implementation could be replaced by some other thing in the future (though it is quite coupled to docker and compose at the moment).

@jsoriano jsoriano added in progress Pull request is currently in progress. discuss Issue needs further discussion. libbeat :Testing labels Jul 31, 2018
Comment thread libbeat/tests/compose/project.go Outdated
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

comment on exported method Project.Wait should be of the form "Wait ..."

Comment thread libbeat/tests/compose/project.go Outdated
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

exported const AnyState should have comment (or a comment on this block) or be unexported

Comment thread libbeat/tests/compose/project.go Outdated
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

comment on exported method Project.Wait should be of the form "Wait ..."

Comment thread libbeat/tests/compose/project.go Outdated
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

exported const AnyState should have comment (or a comment on this block) or be unexported

@jsoriano jsoriano force-pushed the docker-compose-wrapper branch from d15a921 to d881852 Compare July 31, 2018 17:57
@andrewkroh
Copy link
Copy Markdown
Member

andrewkroh commented Jul 31, 2018

This should resolve #5050.

So this can be removed too:

# TODO (elastic/beats#5050): Use a vendored copy of this.
exec { go get github.com/docker/libcompose }

@jsoriano jsoriano force-pushed the docker-compose-wrapper branch from 2363133 to 49b2d7d Compare August 10, 2018 13:58
@jsoriano jsoriano force-pushed the docker-compose-wrapper branch from dc2bdc9 to 2b9d603 Compare August 10, 2018 14:10
@jsoriano jsoriano added review and removed in progress Pull request is currently in progress. labels Aug 10, 2018
@jsoriano
Copy link
Copy Markdown
Member Author

Tests were failing here by a side effect we had caused by having different compose versions. compose up can decide to recreate a container if it was created with a different version, this was happening in python tests when the containers had been started by go tests, and stopped happening when I replaced libcompose.
To keep the old behaviour, I force now to recreate the containers.

Comment thread metricbeat/Dockerfile

RUN pip install --upgrade pip
RUN pip install --upgrade setuptools
RUN pip install --upgrade docker-compose==1.21.0
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.

I think we should update this also in our docs in a follow up PR: https://www.elastic.co/guide/en/beats/devguide/current/beats-contributing.html#running-testsuite

Copy link
Copy Markdown
Contributor

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

WFG

++ on only relying on 1 library / command for the testing especially if libcompose is not maintained.

@ruflin ruflin merged commit 6ef073f into elastic:master Aug 14, 2018
jsoriano added a commit to jsoriano/beats that referenced this pull request Aug 16, 2018
Replace libcompose by a docker compose wrapper to be able to use newer features, and to give a step towards having a unified go-based integration test framework.

Docker compose has multiple implementations, mainly:
* docker-compose itself (python)
* libcompose (go)
* docker swarm services (go)

We are currently using docker-compose and libcompose in tests. docker-compose for python tests, and libcompose for go tests.

libcompose has some problems, it is released as experimental, and its support is quite limited, specially with new features as it only supports till version 2.0 of  the [compose file format](https://docs.docker.com/compose/compose-file/#reference-and-guidelines). We are already using docker compose 2.1 version in libbeat, so we cannot have integration tests implemented in go using libcompose.

docker swarm services implementation of docker compose supports more recent file formats, but is limited by the features not supported by docker swarm. It also requires docker swarm, what is not always convenient.

Wrapping docker-compose from go is not ideal, but docker-compose at the moment is the only maintained and complete implementation. The wrapping code is "hidden" behind interfaces, so implementation could be replaced by some other thing in the future (though it is quite coupled to docker and compose at the moment).

(cherry picked from commit 6ef073f)
ruflin pushed a commit that referenced this pull request Aug 20, 2018
Replace libcompose by a docker compose wrapper to be able to use newer features, and to give a step towards having a unified go-based integration test framework.

Docker compose has multiple implementations, mainly:
* docker-compose itself (python)
* libcompose (go)
* docker swarm services (go)

We are currently using docker-compose and libcompose in tests. docker-compose for python tests, and libcompose for go tests.

libcompose has some problems, it is released as experimental, and its support is quite limited, specially with new features as it only supports till version 2.0 of  the [compose file format](https://docs.docker.com/compose/compose-file/#reference-and-guidelines). We are already using docker compose 2.1 version in libbeat, so we cannot have integration tests implemented in go using libcompose.

docker swarm services implementation of docker compose supports more recent file formats, but is limited by the features not supported by docker swarm. It also requires docker swarm, what is not always convenient.

Wrapping docker-compose from go is not ideal, but docker-compose at the moment is the only maintained and complete implementation. The wrapping code is "hidden" behind interfaces, so implementation could be replaced by some other thing in the future (though it is quite coupled to docker and compose at the moment).

(cherry picked from commit 6ef073f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants