Skip to content

Commit

Permalink
Merge pull request kubernetes#58800 from jianglingxia/jlx-metadata
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue (batch tested with PRs 58783, 58800, 58846). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add UT test to openstack_test.go

**What this PR does / why we need it**:
add ut test to toAuth3Options func
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
  • Loading branch information
Kubernetes Submit Queue authored Jan 26, 2018
2 parents f4bab0b + 0e1972a commit 910d1aa
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions pkg/cloudprovider/providers/openstack/openstack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,3 +585,37 @@ func TestInstanceIDFromProviderID(t *testing.T) {
}
}
}

func TestToAuth3Options(t *testing.T) {
cfg := Config{}
cfg.Global.Username = "user"
cfg.Global.Password = "pass"
cfg.Global.DomainId = "2a73b8f597c04551a0fdc8e95544be8a"
cfg.Global.DomainName = "local"
cfg.Global.AuthUrl = "http://auth.url"
cfg.Global.UserId = "user"

ao := cfg.toAuth3Options()

if !ao.AllowReauth {
t.Errorf("Will need to be able to reauthenticate")
}
if ao.Username != cfg.Global.Username {
t.Errorf("Username %s != %s", ao.Username, cfg.Global.Username)
}
if ao.Password != cfg.Global.Password {
t.Errorf("Password %s != %s", ao.Password, cfg.Global.Password)
}
if ao.DomainID != cfg.Global.DomainId {
t.Errorf("DomainID %s != %s", ao.DomainID, cfg.Global.DomainId)
}
if ao.IdentityEndpoint != cfg.Global.AuthUrl {
t.Errorf("IdentityEndpoint %s != %s", ao.IdentityEndpoint, cfg.Global.AuthUrl)
}
if ao.UserID != cfg.Global.UserId {
t.Errorf("UserID %s != %s", ao.UserID, cfg.Global.UserId)
}
if ao.DomainName != cfg.Global.DomainName {
t.Errorf("DomainName %s != %s", ao.DomainName, cfg.Global.DomainName)
}
}

0 comments on commit 910d1aa

Please sign in to comment.