Discussion:
Any way to have an auto scaling group return fake instances in when using Fog.mock!
JayP
2012-11-19 18:18:35 UTC
Permalink
When creating an auto scaling group in mock mode is there a way to have the
auto scaling group model return some instances?

I could mock out the connector then I would be testing the output of the
fog library which isn't the object in test.

Thanks,
Jay
geemus (Wesley Beary)
2012-11-19 19:11:53 UTC
Permalink
The "fog way" for something like that would be to create some mock
instances and use the mocks to add them to the group. That said, I'm not
sure if all of the plumbing is there to make that work.
Post by JayP
When creating an auto scaling group in mock mode is there a way to have
the auto scaling group model return some instances?
I could mock out the connector then I would be testing the output of the
fog library which isn't the object in test.
Thanks,
Jay
JayP
2012-11-19 20:19:10 UTC
Permalink
Yeah, that would be fine with me but like you said I couldn't find a way.
I'll enter in an issue for this and someone or myself can try to add this.
Post by geemus (Wesley Beary)
The "fog way" for something like that would be to create some mock
instances and use the mocks to add them to the group. That said, I'm not
sure if all of the plumbing is there to make that work.
Post by JayP
When creating an auto scaling group in mock mode is there a way to have
the auto scaling group model return some instances?
I could mock out the connector then I would be testing the output of the
fog library which isn't the object in test.
Thanks,
Jay
geemus (Wesley Beary)
2012-11-19 20:38:49 UTC
Permalink
Sounds good, thanks!
Post by JayP
Yeah, that would be fine with me but like you said I couldn't find a way.
I'll enter in an issue for this and someone or myself can try to add this.
Post by geemus (Wesley Beary)
The "fog way" for something like that would be to create some mock
instances and use the mocks to add them to the group. That said, I'm not
sure if all of the plumbing is there to make that work.
Post by JayP
When creating an auto scaling group in mock mode is there a way to have
the auto scaling group model return some instances?
I could mock out the connector then I would be testing the output of the
fog library which isn't the object in test.
Thanks,
Jay
JayP
2012-11-19 22:18:05 UTC
Permalink
So looks like you can pass in instances to the autoscaling group create but
the keys are different when fetched from a Real compared to Mock.

For example when fetching instances from a mocked auto scaling group you
get this:

"instances"=>
[ <Fog::AWS::AutoScaling::Instance
id="i-750f8b0a",
auto_scaling_group_name=nil,
availability_zone="us-east-1a",
health_status="Healthy",
launch_configuration_name="test",
life_cycle_state="InService"
Post by geemus (Wesley Beary)
],
When fetching one from Real you get this:

"instances"=>
[{"HealthStatus"=>"Healthy",
"AvailabilityZone"=>"us-east-1a",
"InstanceId"=>"i-750f8b0a",
"LaunchConfigurationName"=>
"test",
"LifecycleState"=>"InService"}],
Post by geemus (Wesley Beary)
Sounds good, thanks!
Post by JayP
Yeah, that would be fine with me but like you said I couldn't find a way.
I'll enter in an issue for this and someone or myself can try to add this.
Post by geemus (Wesley Beary)
The "fog way" for something like that would be to create some mock
instances and use the mocks to add them to the group. That said, I'm not
sure if all of the plumbing is there to make that work.
Post by JayP
When creating an auto scaling group in mock mode is there a way to have
the auto scaling group model return some instances?
I could mock out the connector then I would be testing the output of
the fog library which isn't the object in test.
Thanks,
Jay
geemus (Wesley Beary)
2012-11-26 15:22:29 UTC
Permalink
Good to hear you got closer. Looks like we must have some bugs in/around
the way the mocks are working for part of that though. Ideally they should
both be returning something more or less the same.
Post by JayP
So looks like you can pass in instances to the autoscaling group create
but the keys are different when fetched from a Real compared to Mock.
For example when fetching instances from a mocked auto scaling group you
"instances"=>
[ <Fog::AWS::AutoScaling::Instance
id="i-750f8b0a",
auto_scaling_group_name=nil,
availability_zone="us-east-1a",
health_status="Healthy",
launch_configuration_name="test",
life_cycle_state="InService"
Post by geemus (Wesley Beary)
],
"instances"=>
[{"HealthStatus"=>"Healthy",
"AvailabilityZone"=>"us-east-1a",
"InstanceId"=>"i-750f8b0a",
"LaunchConfigurationName"=>
"test",
"LifecycleState"=>"InService"}],
Post by geemus (Wesley Beary)
Sounds good, thanks!
Post by JayP
Yeah, that would be fine with me but like you said I couldn't find a
way. I'll enter in an issue for this and someone or myself can try to add
this.
Post by geemus (Wesley Beary)
The "fog way" for something like that would be to create some mock
instances and use the mocks to add them to the group. That said, I'm not
sure if all of the plumbing is there to make that work.
Post by JayP
When creating an auto scaling group in mock mode is there a way to
have the auto scaling group model return some instances?
I could mock out the connector then I would be testing the output of
the fog library which isn't the object in test.
Thanks,
Jay
Loading...