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

Resolve Test Imports #461

Merged
merged 16 commits into from
Jun 21, 2016
Merged

Resolve Test Imports #461

merged 16 commits into from
Jun 21, 2016

Conversation

mattfarina
Copy link
Member

@mattfarina mattfarina commented Jun 6, 2016

This is ready to be tested. glide init finds test dependencies. glide update resolves their tree, unless flag opts-out, and glide install will install them (unless opt-out flag is used).

Note, test dependencies in vendor/ are not handled. Just those in local codebase.

@mattfarina mattfarina self-assigned this Jun 6, 2016
@mattfarina mattfarina added this to the 0.11 milestone Jun 6, 2016
@ches
Copy link

ches commented Jun 18, 2016

Tried this out on a (albeit small) project that's using Ginkgo and Gomega, and it picked them up and installed them as expected 👍

One question: should this be writing to the testImport section of glide.yaml? Because that didn't happen for me. I ran rm -rf vendor glide.* on a copy of a project, then glide init followed by glide install.

@mattfarina
Copy link
Member Author

@ches test imports should end up on testImport. But, if the import is also used in the app it will show up in import instead. testImports is for imports that are only used in tests and nowhere else.

This is done because you can't safely have different versions of the same import in use.

@technosophos
Copy link
Member

My test:

  • Started with github.com/kubernetes/helm
  • Changed a test to use github.com/arschles/assert
  • Ran glide get --test github.com/arschles/assert

The good news is that the testImport entry was correctly created, the fetch worked, and the glide.yaml|lock files were generated. The bad news is that something with fetching Kubernetes broke:

[INFO]  Downloading dependencies. Please wait...
[INFO]  Fetching updates for k8s.io/kubernetes/pkg/client/unversioned/remotecommand.
[INFO]  Fetching updates for k8s.io/kubernetes/pkg/kubectl/cmd/util.
[INFO]  Fetching updates for github.com/golang/protobuf/ptypes/any.
[INFO]  Fetching updates for k8s.io/kubernetes/pkg/client/unversioned/clientcmd.
[WARN]  k8s.io/kubernetes/pkg/client/unversioned/remotecommand appears to be a vendored package. Unable to update. Consider the '--update-vendored' flag.
[WARN]  k8s.io/kubernetes/pkg/kubectl/cmd/util appears to be a vendored package. Unable to update. Consider the '--update-vendored' flag.
[WARN]  github.com/golang/protobuf/ptypes/any appears to be a vendored package. Unable to update. Consider the '--update-vendored' flag.
[WARN]  k8s.io/kubernetes/pkg/client/unversioned/clientcmd appears to be a vendored package. Unable to update. Consider the '--update-vendored' flag.
[INFO]  Fetching updates for github.com/ghodss/yaml.
[INFO]  Fetching updates for github.com/golang/protobuf/proto.
[INFO]  Fetching updates for k8s.io/kubernetes/pkg/api.
[INFO]  Fetching updates for k8s.io/kubernetes/pkg/labels.
[INFO]  Fetching updates for github.com/golang/protobuf/ptypes/timestamp.
[WARN]  github.com/golang/protobuf/proto appears to be a vendored package. Unable to update. Consider the '--update-vendored' flag.
[INFO]  Fetching updates for golang.org/x/net/context.
[WARN]  k8s.io/kubernetes/pkg/api appears to be a vendored package. Unable to update. Consider the '--update-vendored' flag.
[WARN]  k8s.io/kubernetes/pkg/labels appears to be a vendored package. Unable to update. Consider the '--update-vendored' flag.
[WARN]  github.com/golang/protobuf/ptypes/timestamp appears to be a vendored package. Unable to update. Consider the '--update-vendored' flag.
[INFO]  Fetching updates for k8s.io/kubernetes/pkg/kubectl/resource.
[WARN]  golang.org/x/net/context appears to be a vendored package. Unable to update. Consider the '--update-vendored' flag.
[INFO]  Fetching updates for k8s.io/kubernetes/pkg/client/unversioned/portforward.
[WARN]  k8s.io/kubernetes/pkg/kubectl/resource appears to be a vendored package. Unable to update. Consider the '--update-vendored' flag.
[WARN]  k8s.io/kubernetes/pkg/client/unversioned/portforward appears to be a vendored package. Unable to update. Consider the '--update-vendored' flag.
[INFO]  Downloading dependencies. Please wait...
[INFO]  Fetching updates for k8s.io/kubernetes/pkg/api/meta.
[INFO]  Fetching updates for google.golang.org/grpc/metadata.
[WARN]  k8s.io/kubernetes/pkg/api/meta appears to be a vendored package. Unable to update. Consider the '--update-vendored' flag.
[WARN]  google.golang.org/grpc/metadata appears to be a vendored package. Unable to update. Consider the '--update-vendored' flag.
[INFO]  Fetching updates for k8s.io/kubernetes/pkg/client/unversioned/fake.
[WARN]  k8s.io/kubernetes/pkg/client/unversioned/fake appears to be a vendored package. Unable to update. Consider the '--update-vendored' flag.
[INFO]  Setting version for github.com/Masterminds/semver to 1.1.0.
[INFO]  Detected semantic version. Setting version for github.com/Masterminds/sprig to 2.2.0.

And the relevant portion of glide.lock:

   - pkg/storage
   - pkg/kubelet/qos
   - pkg/master/ports
+  - pkg/api/testapi
+  - federation/apis/federation
+  - federation/apis/federation/install
+  - federation/apis/federation/v1alpha1
+- name: k8s.io/kubernetes/pkg/api
+  version: 9990f843cd62caa90445cf76b07d63ba7b5c86fd
+- name: k8s.io/kubernetes/pkg/client/unversioned/clientcmd
+  version: 9990f843cd62caa90445cf76b07d63ba7b5c86fd
+- name: k8s.io/kubernetes/pkg/client/unversioned/portforward
+  version: 9990f843cd62caa90445cf76b07d63ba7b5c86fd
+- name: k8s.io/kubernetes/pkg/client/unversioned/remotecommand
+  version: 9990f843cd62caa90445cf76b07d63ba7b5c86fd
+- name: k8s.io/kubernetes/pkg/kubectl/cmd/util
+  version: 9990f843cd62caa90445cf76b07d63ba7b5c86fd
+- name: k8s.io/kubernetes/pkg/kubectl/resource
+  version: 9990f843cd62caa90445cf76b07d63ba7b5c86fd
+- name: k8s.io/kubernetes/pkg/labels
+  version: 9990f843cd62caa90445cf76b07d63ba7b5c86fd

- Fixes cases where dependency can end up on imports list multiple times
- I think this fixes parsing top level packages even when now used
@mattfarina
Copy link
Member Author

@technosophos fixed the broke thing.

@mattfarina mattfarina merged commit 31debc2 into master Jun 21, 2016
@mattfarina mattfarina deleted the feat/resolve-test-imports branch June 21, 2016 14:14
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.

3 participants