-
Notifications
You must be signed in to change notification settings - Fork 959
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial commit integrate init with api * Revert "Initial commit integrate init with api" This reverts commit 1475151. * removed internaltesting:frameworks:int command * integrate git repo with cloudBuildRepo * Added changes to create stack * Added changes to create stack * Added code to omit output fields in Stack * Added poller operation * Added poller operation * Added code to integrate init flow to link Git repo and to call frameworks api * Minor changes * minor changes * deleted output file * Rearranged files * Fix imports * Reorganized files * minor changes
- Loading branch information
Showing
7 changed files
with
129 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import * as sinon from "sinon"; | ||
import { expect } from "chai"; | ||
|
||
import * as gcp from "../../../gcp/frameworks"; | ||
import * as poller from "../../../operation-poller"; | ||
import { createStack } from "../../../init/features/frameworks/index"; | ||
|
||
describe("operationsConverter", () => { | ||
const sandbox: sinon.SinonSandbox = sinon.createSandbox(); | ||
|
||
let pollOperationStub: sinon.SinonStub; | ||
let createStackStub: sinon.SinonStub; | ||
|
||
beforeEach(() => { | ||
pollOperationStub = sandbox | ||
.stub(poller, "pollOperation") | ||
.throws("Unexpected pollOperation call"); | ||
createStackStub = sandbox.stub(gcp, "createStack").throws("Unexpected createStack call"); | ||
}); | ||
|
||
afterEach(() => { | ||
sandbox.verifyAndRestore(); | ||
}); | ||
|
||
describe("createStack", () => { | ||
const projectId = "projectId"; | ||
const location = "us-central1"; | ||
const stackId = "stackId"; | ||
const stackInput = { | ||
name: stackId, | ||
codebase: { | ||
repository: `projects/${projectId}/locations/${location}/connections/${stackId}`, | ||
rootDirectory: "/", | ||
}, | ||
labels: {}, | ||
}; | ||
const op = { | ||
name: `projects/${projectId}/locations/${location}/stacks/${stackId}`, | ||
done: true, | ||
}; | ||
const completeStack = { | ||
name: `projects/${projectId}/locations/${location}/stacks/${stackId}`, | ||
codebase: { | ||
repository: `projects/${projectId}/locations/${location}/connections/${stackId}`, | ||
rootDirectory: "/", | ||
}, | ||
labels: {}, | ||
createTime: "0", | ||
updateTime: "1", | ||
uri: "https://placeholder.com", | ||
}; | ||
|
||
it("checks is correct arguments are sent & creates a stack", async () => { | ||
createStackStub.resolves(op); | ||
pollOperationStub.resolves(completeStack); | ||
|
||
await createStack(projectId, location, stackInput); | ||
expect(createStackStub).to.be.calledWith(projectId, location, stackInput); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters